public ActionResult Update() { int pid = Int32.Parse(Request["update_productID"]); int price = Int32.Parse(Request["price"]); string category = Request["update_category"]; string description = Request["update_description"]; string src = Request["update_source"]; Product p = de1.Products.Find(pid); p.Price = price; p.Category = category; p.Desc = description; p.Src = src; de1.Entry(p).State = System.Data.EntityState.Modified; de1.SaveChanges(); Session["msg"] = " Item Updated successfully"; ViewBag.msg = " Item Updated successfully"; return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Username,Email,Mobile,Org_Name,Id_Proof,Password")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult AddCart(int id) { Session["cart"] = "cart"; if (Session["Id"] != null) { int id3 = isExisting(id); if (id3 == -1) { Product p11 = de1.Products.Find(id); Cart c11 = new Cart(); c11.CID = (Int32)Session["Id"]; c11.PID = p11.Id; c11.Quantity = 1; c11.STotal = p11.Price * c11.Quantity; de1.Carts.Add(c11); de1.SaveChanges(); var v = de1.Carts.Where(a => a.CID == c11.CID).ToList(); return(RedirectToAction("IndexC")); } else { Cart c22 = de1.Carts.Find(id3); c22.Quantity = c22.Quantity + 1; Product p22 = de1.Products.Find(c22.PID); c22.STotal = c22.STotal + p22.Price; de1.Entry(c22).State = System.Data.EntityState.Modified; de1.SaveChanges(); return(RedirectToAction("IndexC")); } } else { Session["ErrorCart"] = "Please Log in first to continue.. "; return(RedirectToAction("Index", "Home")); } }