public async Task <bool> SaveChangesAsync() { _logger.LogInformation($"Attempitng to save the changes in the context"); // Only return success if at least one row was changed return((await _context.SaveChangesAsync()) > 0); }
public async Task <IActionResult> Create([Bind("CustomerId,ProductId,RackId,OrderQty,ColumnNumber,RowNumber,EntryDate,DiscontinuedDate")] StorageOrderCreateViewModel storageOrderViewModel) { if (ModelState.IsValid) { var storageOrder = _mapper.Map <StorageOrder>(storageOrderViewModel); _context.Add(storageOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), "Customers")); } return(RedirectToAction(nameof(Index), "Customers")); }