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"));
        }
Пример #2
0
 public void Add <T>(T entity) where T : class
 {
     _logger.LogInformation($"Adding an object of type {entity.GetType()} to the context.");
     _context.Add(entity);
 }