Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ADD_TO_CART cart = specsDetailsEntities.ADD_TO_CART.Find(id);

            specsDetailsEntities.ADD_TO_CART.Remove(cart);
            specsDetailsEntities.SaveChanges();
            return(RedirectToAction("ViewCart"));
        }
Beispiel #2
0
        public ActionResult Remove_from_cart(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ADD_TO_CART cart = specsDetailsEntities.ADD_TO_CART.Find(id);

            if (cart == null)
            {
                return(HttpNotFound());
            }
            return(View(cart));
        }
Beispiel #3
0
        public ActionResult OrderNow()
        {
            string       email      = TempData.Peek("CUSTOMER_EMAIL").ToString();
            USERREGISTER user       = specsDetailsEntities.USERREGISTERs.FirstOrDefault(eid => eid.EMAILID == email);
            ADD_TO_CART  cart       = specsDetailsEntities.ADD_TO_CART.FirstOrDefault(id => id.EMAILID == email);
            OrderModel   orderModel = new OrderModel();

            if (cart != null)
            {
                orderModel.SPECS_ID    = cart.SPECS_ID;
                orderModel.SPECS_NAME  = cart.SPECS_NAME;
                orderModel.SPECS_PRICE = cart.SPECS_PRICE;
                orderModel.EMAILID     = cart.EMAILID;
            }
            else
            {
                ViewBag.Message = "Cart is Empty";
            }
            return(View(orderModel));
        }
Beispiel #4
0
 public ActionResult Add_To_cart(ViewCart view)
 {
     try
     {
         SPECS_DETAILS specs = specsDetailsEntities.SPECS_DETAILS.FirstOrDefault(id => id.SPECS_ID == view.SPECS_ID);
         ADD_TO_CART   add   = new ADD_TO_CART();
         add.SPECS_ID    = view.SPECS_ID;
         add.SPECS_NAME  = view.SPECS_NAME;
         add.QUANTITY    = view.QUANTITY;
         add.SPECS_PRICE = (view.QUANTITY) * (view.SPECS_PRICE);
         add.EMAILID     = TempData.Peek("CUSTOMER_EMAIL").ToString();
         specsDetailsEntities.ADD_TO_CART.Add(add);
         specsDetailsEntities.SaveChanges();
         ViewBag.Message = "Added To cart Sucessfully";
         return(RedirectToAction("ViewSpecs"));
     }
     catch (Exception e)
     {
         return(View("Error" + e.Message));
     }
 }