Пример #1
0
        public ActionResult AddToCart(int productId)
        {
            if (ModelState.IsValid)
            {
                cheque_set cheque_set = new cheque_set();
                cheque_set.cust_id               = AccountController.id;
                cheque_set.product_address_id    = cs.product_address.Include(p => p.product).Where(p => p.product_id == productId && p.size_id == 32 && p.product_amount == 0).Select(p => p.product_address_id).FirstOrDefault();
                cheque_set.cheque_product_amount = 1;
                cheque_set.prod_date             = DateTime.Now;
                cs.cheque_set.Add(cheque_set);
                cs.SaveChanges();

                status_of_cheque soc = new status_of_cheque();
                soc.cheque_prod_id   = cheque_set.cheque_prod_id;
                soc.cheque_status_id = 1;
                soc.status_date      = DateTime.Now;
                cs.status_of_cheque.Add(soc);
                cs.SaveChanges();

                TempData["Success"] = "Success message text.";

                return(RedirectToAction("Index"));
            }

            return(View("Index"));
        }
Пример #2
0
        public ActionResult EditStatus()
        {
            if (ModelState.IsValid)
            {
                status_of_cheque soc = new status_of_cheque();
                soc.status_date      = DateTime.Now;
                soc.cheque_status_id = stat + 1;
                soc.cheque_prod_id   = cid;
                db.status_of_cheque.Add(soc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            OrderViewModel model = new OrderViewModel();

            return(View(model.CreateModelStore()));
        }
Пример #3
0
        // GET: Order/Edit/5
        public ActionResult EditStatus(int?id, int statId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            status_of_cheque soc = db.status_of_cheque.Include(p => p.cheque_set).Include(p => p.dict_product_status).Where(p => p.cheque_prod_id == id && p.cheque_status_id == statId).Select(p => p).FirstOrDefault();

            if (soc == null)
            {
                return(HttpNotFound());
            }

            cid  = Convert.ToInt32(id);
            stat = statId;

            ViewBag.stats = db.dict_product_status;
            return(View(soc));
        }