public ActionResult DeleteConfirm(int id) { SessionCartManager sessCartMgr = new SessionCartManager(); sessCartMgr.DeleteRegistration(id); //Does the Delete return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { SessionCartManager sessCrtMgr = new SessionCartManager(); SessionCart sessCart = sessCrtMgr.GetSessionCart(id); SessionCartViewModel sessCartVM = new SessionCartViewModel(sessCart); return(View(sessCartVM)); }
// GET: SessionCart public ActionResult Index() { SessionCartManager cartMgr = new SessionCartManager(); IQueryable <SessionCart> allItems = cartMgr.GetAllSessionsByUser(User.Identity.Name, null); List <SessionCartViewModel> cartVM = new List <SessionCartViewModel>(); foreach (var item in allItems) { cartVM.Add(new SessionCartViewModel(item)); } return(View(cartVM)); }
public ActionResult Index(List <SessionViewModel> allSessionsVM) { //Filter all Products View Model to be selected only allSessionsVM = allSessionsVM.Where(p => p.IsSelected == true).ToList(); //Build ShoppingCart Manager SessionCartManager cartMgr = new SessionCartManager(); //Add Selected Products to the ShoppingCart foreach (SessionViewModel sessVM in allSessionsVM) { cartMgr.AddToCart(User.Identity.Name, sessVM.Id); } //Redirect to Shopping Cart View return(RedirectToAction("Index", "SessionCart")); }