public ActionResult ConfirmOrder() { string userName = this.User.Identity.Name; ConfirmedOrderVm vm = service.GetOrderId(userName); return(View(vm)); }
public ConfirmedOrderVm GetOrderId(string userName) { Customer customer = Context.Customers.FirstOrDefault(cust => cust.User.UserName == userName); Order order = Context.Orders.OrderByDescending(order1 => order1.Id).FirstOrDefault(ord => ord.Buyer.Id == customer.Id); int orderId = order.Id; ConfirmedOrderVm vm = new ConfirmedOrderVm() { OrderId = orderId }; return(vm); }