/// <summary> /// Action that gives us the index of the admin dashboard /// </summary> /// <returns>View with a UserViewModel</returns> public async Task <IActionResult> Index() { UserViewModel uvm = new UserViewModel(); var productList = await _context.GetProducts(); uvm.Products = productList; var orderList = await _orders.GetRecentOrders(); uvm.Orders = orderList; uvm.Users = new List <ApplicationUser>(); foreach (var order in orderList) { ApplicationUser user = new ApplicationUser(); user.Id = order.UserID; var claims = await _userManager.GetClaimsAsync(user); string[] fullName = claims.First(c => c.Type == "FullName") .Value .Split(" "); user.FirstName = fullName[0]; user.LastName = fullName[1]; uvm.Users.Add(user); } return(View(uvm)); }
public async Task OnGet() { var userID = _userManager.GetUserId(User); Orders = await _order.GetRecent3Orders(userID); Products = await _context.GetProducts(); }
public async Task <IActionResult> Index() { UserViewModel uvm = new UserViewModel { Products = await _context.GetProducts() }; return(View(uvm)); }
public List <Product> GetProducts() { return(warehouse.GetProducts()); }