public ActionResult Index() { CustomerM customer = authService.DecodeJWT(User.Identity.Name); List <ShoppingDTO> shoppings = new List <ShoppingDTO>(); foreach (var shopping in shoppingService.FindAll().Where(x => x.CustomerId == customer.Id && x.Status == "Active")) { shoppings.Add(new ShoppingDTO() { MobileName = mobileService.FindById(shopping.MobileId).Name, ShopName = shopService.FindById(shopping.ShopId).ShopName, Id = shopping.Id, Price = shopping.Price, ShopId = shopping.ShopId, MobileId = shopping.MobileId, CustomerId = shopping.CustomerId, }); } return(View(shoppings)); }
public ActionResult History() { CustomerM admin = authService.DecodeJWT(User.Identity.Name); ShopM shop = shopService.FindById(admin.ShopAdminId); List <ShoppingDTO> shoppings = new List <ShoppingDTO>(); foreach (var shopping in shoppingService.FindAll().Where(x => x.ShopId == shop.Id)) { shoppings.Add(new ShoppingDTO() { Id = shopping.Id, Customer = admin.Email, CustomerId = admin.Id, MobileId = shopping.MobileId, MobileName = mobileService.FindById(shopping.MobileId).Name, Price = shopping.Price, Status = shopping.Status, }); } return(View(shoppings)); }