Use Add instead of AddAsync
This commit is contained in:
parent
7da71fc5ee
commit
5b55da271c
|
|
@ -99,7 +99,7 @@ namespace MusicStore.Apis
|
||||||
|
|
||||||
// Save the changes to the DB
|
// Save the changes to the DB
|
||||||
var dbAlbum = new Album();
|
var dbAlbum = new Album();
|
||||||
await _storeContext.Albums.AddAsync(SimpleMapper.Map(album, dbAlbum));
|
_storeContext.Albums.Add(SimpleMapper.Map(album, dbAlbum));
|
||||||
await _storeContext.SaveChangesAsync();
|
await _storeContext.SaveChangesAsync();
|
||||||
|
|
||||||
// TODO: Handle missing record, key violations, concurrency issues, etc.
|
// TODO: Handle missing record, key violations, concurrency issues, etc.
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace MusicStore.Areas.Admin.Controllers
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
await _dbContext.Albums.AddAsync(album, Context.RequestAborted);
|
_dbContext.Albums.Add(album);
|
||||||
await _dbContext.SaveChangesAsync(Context.RequestAborted);
|
await _dbContext.SaveChangesAsync(Context.RequestAborted);
|
||||||
|
|
||||||
var albumData = new AlbumData
|
var albumData = new AlbumData
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace MusicStore.Controllers
|
||||||
order.OrderDate = DateTime.Now;
|
order.OrderDate = DateTime.Now;
|
||||||
|
|
||||||
//Add the Order
|
//Add the Order
|
||||||
await _dbContext.Orders.AddAsync(order, Context.RequestAborted);
|
_dbContext.Orders.Add(order);
|
||||||
|
|
||||||
//Process the order
|
//Process the order
|
||||||
var cart = ShoppingCart.GetCart(_dbContext, Context);
|
var cart = ShoppingCart.GetCart(_dbContext, Context);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue