private bool disposedValue = false; // To detect redundant calls #endregion Fields #region Constructors public ServiceManager() { context = new TankshopDbContext(); Categories = new CategoryService(new CategoryRepository(context)); Products = new ProductService(new ProductRepository(context)); Images = new ImageBLL(); Accounts = new AccountBLL(); }
public ActionResult Checkout() { if (Session["LoggedIn"] != null) { if ((bool)Session["LoggedIn"]) { var ch = new CookieHandler(); var Email = (string)Session["Email"]; var pidList = ch.GetCartProductIds(); var productModelList = Services.Products.GetAll(pidList); var cart = productModelList.Select(p => new CartItem() { ProductId = p.Id, Name = p.Name, Count = ch.GetCount(p.Id), Price = p.Price }).ToList(); var customerModel = new AccountBLL().GetCustomer(Email); var customer = new CustomerView() { Firstname = customerModel.Firstname, Lastname = customerModel.Lastname, Address = customerModel.Address, Zipcode = customerModel.Zipcode, City = customerModel.City, Id = customerModel.CustomerId, Email = customerModel.Email }; ViewBag.Cart = cart; ViewBag.Customer = customer; ViewBag.LoggedIn = LoginStatus(); return View(); } } return RedirectToAction("Index", "Home"); }