public ActionResult Orders() { var costumerOrdersViewModel = new CostumerOrdersViewModel(); costumerOrdersViewModel.Orders = _context.Orders.Where(o => o.CustomerId == _customer.Id).OrderBy(o => o.Date).ToArray(); return(View("Orders", costumerOrdersViewModel)); }
public ActionResult Index() { var userId = User.Identity.GetUserId().ToString(); var customer = _context.Customers.SingleOrDefault(c => c.ApplicationUserId == userId); var costumerOrdersViewModel = new CostumerOrdersViewModel(); costumerOrdersViewModel.Orders = _context.Orders.Where(o => o.CustomerId == customer.Id).OrderBy(o => o.Date).ToArray(); return(View("Index", costumerOrdersViewModel)); }