public PartialViewResult _CartSummary() { iCartManager cart = (iCartManager)Session["USERCART"]; if (cart == null) { cart = (iCartManager)(new CartManager()); Session["USERCART"] = cart; } var cartItems = cart.ConvertCartDetails(); return(PartialView(cartItems)); }
public bool SubmitOrder(int id, int kioskId, string customer) { try { iCartManager cart = (iCartManager)Session["USERCART"]; if (cart == null) { cart = (iCartManager)(new CartManager()); Session["USERCART"] = cart; } var cartSession = cart.ConvertCartDetails(); if (cartSession == null) { return(false); } var userId = GetUserId(); cartSession.FirstOrDefault().StoreDetail = null; cartSession.FirstOrDefault().DeliveryType = "Kiosk"; cartSession.FirstOrDefault().UserDetailId = store.CartMgr.GetUserDetails(userId).Id; var cartId = store.CartMgr.SaveKioskOrder(cartSession, userId, id); if (cartId > 0) { //save to db var kioskOrder = new StoreKioskOrder() { CartDetailId = cartId, StoreKioskId = kioskId, DtOrder = DateTime.Now, Customer = customer.Trim() }; //save storeKioskOrder var kioskOrderRes = store.CartMgr.AddStoreKioskOrder(kioskOrder); if (kioskOrderRes) { ClearCart(); return(true); } } return(false); } catch (Exception ex) { throw ex; } }
public ActionResult CartCheckout(int kioskId, string customer) { iCartManager cart = (iCartManager)Session["USERCART"]; if (cart == null) { cart = (iCartManager)(new CartManager()); Session["USERCART"] = cart; } var cartItems = cart.ConvertCartDetails(); ViewBag.Name = customer; ViewBag.KioskId = kioskId; return(View(cartItems)); }
public bool AddToCart(int id, int qty) { try { iCartManager cart = (iCartManager)Session["USERCART"]; if (cart == null) { cart = (iCartManager)(new CartManager()); } int currentstoreid = (int)Session["STOREID"]; cart.AddItem(currentstoreid, id, qty); Session["USERCART"] = cart; return(true); } catch { return(false); } }
public bool RemoveCartItem(int id) { try { iCartManager cart = (iCartManager)Session["USERCART"]; if (cart == null) { return(false); } int currentstoreid = (int)Session["STOREID"]; cart.RemoveItem(currentstoreid, id); Session["USERCART"] = cart; return(true); } catch (Exception e) { return(false); } }