public async Task <IActionResult> Details(Guid id) { AppUser user = new AppUser(); if (signInManager.IsSignedIn(User)) { user = await userManager.GetUserAsync(User); AppUserVM appUserVM = new AppUserVM(); appUserVM.Orders = orderService.GetByIdUser(user.Id); appUserVM.OrderDetails = orderService.GetOrderDetails(id); foreach (var item in appUserVM.OrderDetails) { var products = productService.GetById(item.ProductId); item.Products = products; } return(View(appUserVM)); } else { return(RedirectToAction("Login", "Account", new { Area = "Member" })); } }
public async Task <IActionResult> Profile() { AppUser user = new AppUser(); if (signInManager.IsSignedIn(User)) { user = await userManager.GetUserAsync(User); var userAdress = userAdressService.GetByIdUser(user.Id); AppUserVM appUserVM = new AppUserVM(); var userOrders = orderService.GetByIdUser(user.Id); List <Order> orders = new List <Order>(); foreach (var item in userOrders) { orders.Add(item); } appUserVM.Orders = orders; appUserVM.Email = user.Email; appUserVM.UserName = user.UserName; List <UserAdress> userAdresList = new List <UserAdress>(); foreach (var item in userAdress) { userAdresList.Add(item); } appUserVM.UserAdresses = userAdresList; return(View(appUserVM)); } else { return(RedirectToAction("Login", "Account", new { Area = "Member" })); } }