// GET: Customers/Details/5
 public async Task <IActionResult> Details(int id)
 {
     try
     {
         return(View(await _customers.GetByIdAsync(id)));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Beispiel #2
0
        public async Task AddAsync(Order model)
        {
            Order orders = new Order()
            {
                Customer    = await _customers.GetByIdAsync(model.CustomerId),
                Supermarket = await _superMarkets.GetByIdAsync(model.SupermarketId),
                OrderDate   = model.OrderDate
            };
            await _dbContext.Orders.AddAsync(orders);

            await _dbContext.SaveChangesAsync();
        }