// // GET: /Cart/ public ActionResult Index() { if (Convert.ToBoolean(Session["LoggedIN"]) == true) { ViewBag.userName = Session["userName"]; ViewBag.logged = Session["LoggedIN"]; iCart_Service cart = Service_Center.GetCart_Service(); int totalSum = 0; IEnumerable <Cart> CartAll = cart.Get(Session["userName"].ToString()); foreach (Cart c in CartAll) { int sum = c.BuyingQuantity * c.ProductPrice; totalSum += sum; } ViewBag.totalPrice = totalSum; return(View(cart.Get(Session["userName"].ToString()))); } else { return(RedirectToAction("Index", "userAuthentication")); } }
public ActionResult SelectItem(int productID) { ViewBag.userName = Session["userName"]; ViewBag.logged = Session["LoggedIN"]; //ViewBag.id = productID; iProduct_Service product = Service_Center.GetProduct_Service(); int catid = product.Get(productID).Category_ID; int subcatid = product.Get(productID).Sub_Category_ID; iCategory_Service cat = Service_Center.GetCategory_Service(); iSub_Category_Service sub = Service_Center.GetSub_Category_Service(); ViewBag.categoryName = cat.Get(catid).Category_Name; ViewBag.subcategoryName = sub.Get(subcatid).Sub_Category_Name; ViewBag.productPicture = Url.Content(product.Get(productID).Product_Picture); Session["SelectItemDetails"] = productID; if (product.Get(productID).Product_Quantity > 5) { ViewBag.productStatus = "In Stock"; } else { ViewBag.productStatus = "Out of Stock"; } return(View(product.Get(productID))); }
public ActionResult fullCartDelete() { iCart_Service cart = Service_Center.GetCart_Service(); int de = cart.DeleteUserCart(Session["userName"].ToString()); return(RedirectToAction("Index", "Home")); }
public ActionResult Delete(int id) { iCart_Service cart = Service_Center.GetCart_Service(); int i = cart.DeleteItem(id); return(RedirectToAction("Index")); }
public ActionResult Index(int cat) { ViewBag.userName = Session["userName"]; ViewBag.logged = Session["LoggedIN"]; iCategory_Service category = Service_Center.GetCategory_Service(); @ViewBag.CategoryName = category.Get(cat).Category_Name; return(View(product.GetByCategory(cat))); }
public ActionResult UpdateIncreaseOne(int id) { iCart_Service cart = Service_Center.GetCart_Service(); Cart c = new Cart(); c.Id = id; c.BuyingQuantity = cart.GetbyID(id).BuyingQuantity + 1; int i = cart.Update(c); return(RedirectToAction("Index")); }
public ActionResult UpdateDecresceOne(int id) { iCart_Service cart = Service_Center.GetCart_Service(); Cart c = new Cart(); if (cart.GetbyID(id).BuyingQuantity > 1) { c.Id = id; c.BuyingQuantity = cart.GetbyID(id).BuyingQuantity - 1; int i = cart.Update(c); return(RedirectToAction("Index")); } else { int i = cart.DeleteItem(id); return(RedirectToAction("Index")); } }
public ActionResult AddingToCart() { if (Convert.ToBoolean(Session["LoggedIN"]) == true) { iCart_Service cartService = Service_Center.GetCart_Service(); iProduct_Service product = Service_Center.GetProduct_Service(); iCategory_Service cat = Service_Center.GetCategory_Service(); iSub_Category_Service sub = Service_Center.GetSub_Category_Service(); int productID = Convert.ToInt32(Session["SelectItemDetails"]); int catid = product.Get(productID).Category_ID; int subcatid = product.Get(productID).Sub_Category_ID; Cart cart = new Cart(); cart.ProductID = productID; cart.ProductName = product.Get(productID).Product_Name; cart.ProductCategory = cat.Get(catid).Category_Name; cart.ProductSubCategory = sub.Get(subcatid).Sub_Category_Name; cart.ProductPicture = product.Get(productID).Product_Picture; cart.ProductPrice = product.Get(productID).Product_Price; cart.BuyingQuantity = Convert.ToInt32(Request.Form["quantityItem"]); cart.Username = Session["userName"].ToString(); int i = cartService.Insert(cart); if (i == 1) { return(RedirectToAction("Index", "Cart")); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "userAuthentication")); } }
public ActionResult CreateAfter() { iLog_in_Service logNew = Service_Center.GetLog_in_Service(); User_Info uNew = new User_Info(); Log_in lnew = new Log_in(); if (Request.Form["signUP"] != null) { if (Request.Form["passtxt"] == Request.Form["rePasstxt"]) { uNew.User_name = Request.Form["usernametxt"]; uNew.User_Full_name = Request.Form["fullnametxt"]; uNew.User_Email = Request.Form["emailtxt"]; uNew.User_Mobile = Request.Form["mobiletxt"]; uNew.User_Gender = Request.Form["genderSelect"]; uNew.User_DateOfBirth = Convert.ToDateTime(Request.Form["DOB"]); lnew.User_Name = Request.Form["usernametxt"]; lnew.Password = Request.Form["passtxt"]; int i = user.Insert(uNew); int j = logNew.Insert(lnew); return(RedirectToAction("Index", "userAuthentication")); } else { Session["signUPerrmsg"] = "Password Not matched"; return(RedirectToAction("Create")); } } else { return(View()); } }
// // GET: /BuyingConfimation/ public ActionResult Index() { ViewBag.userName = Session["userName"]; ViewBag.logged = Session["LoggedIN"]; iCart_Service cart = Service_Center.GetCart_Service(); iProduct_Service productAll = Service_Center.GetProduct_Service();// iBuying_History_Service buyingHistory = Service_Center.GetBuying_History_Service(); iProduct_Report_Service report = Service_Center.GetProduct_Report_Service(); IEnumerable <Cart> FullCart = cart.Get(Session["userName"].ToString()); foreach (Cart c in FullCart) { Product pro = new Product(); IEnumerable <Product> proAll = productAll.GetAllValues(); foreach (Product p in proAll) { if (p.Id == c.ProductID) { int before = productAll.Get(p.Id).Product_Quantity; int after = before - c.BuyingQuantity; pro.Id = p.Id; pro.Product_Quantity = after; int y = productAll.Update(pro); } } Buying_History buy = new Buying_History(); Product_Report rep = new Product_Report(); buy.Product_ID = c.ProductID; buy.User_Name = Session["userName"].ToString(); buy.Buying_Quantity = c.BuyingQuantity; buy.Buying_Date = DateTime.Now.ToLocalTime(); IEnumerable <Product_Report> proReport = report.GetAllValues(); bool check = false; int productID = 0; foreach (Product_Report r in proReport) { if (r.Product_ID == c.ProductID) { check = true; productID = r.Product_ID; break; } } if (check == true) { int beforeQuantity = report.Get(productID).Selling_Quantity; int afterQuantity = beforeQuantity + c.BuyingQuantity; rep.Product_ID = productID; rep.Selling_Quantity = afterQuantity; int p = report.Update(rep); } else { rep.Product_ID = c.ProductID; rep.Selling_Quantity = c.BuyingQuantity; int j = report.Insert(rep); } int i = buyingHistory.Insert(buy); } int de = cart.DeleteUserCart(Session["userName"].ToString()); //ViewBag.row = cartRow; return(View()); }