public async Task <IActionResult> AcceptOrder(int OrdersId, string BookName, string Email) { if (ModelState.IsValid) { var orderConfimation = await _context.Orders.FindAsync(OrdersId); if (orderConfimation == null) { return(NotFound()); } var user = await _userManager.GetUserAsync(User); var result = _context.Books.SingleOrDefault(b => b.EmailCreator == user.Email && b.BookName == BookName); result.isRented = true; _context.Orders.Remove(orderConfimation); var xpto = _context.Orders.Where(b => b.BookName == BookName).ToList(); _context.Orders.RemoveRange(xpto); var acceptedOrders = new AcceptedOrders { BookName = BookName, Email = Email }; _context.AcceptedOrders.Add(acceptedOrders); await _context.SaveChangesAsync(); } return(RedirectToAction("")); }
public void AcceptOrder(OrderModel order) { AwaitingOrders.Remove(order); AcceptedOrders.Add(order); _waiterConnectionProvider.AcceptOrder(order.OrderId); NotifyOfPropertyChange(() => CanEndOrder); }
private void UpdateAfterEndOrder(int orderId) { _acceptedOrdersCache.Remove(orderId); SelectedAcceptedOrderMenuItems.Clear(); AcceptedOrders.Remove(SelectedAcceptedOrder); RecalculateTotalPrice(); }