public ActionResult Create(Admin admin)
        {
            if (ModelState.IsValid)
            {
                db.admin.Add(admin);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(admin));
        }
        public ActionResult Create(ProductBrand productbrand)
        {
            if (ModelState.IsValid)
            {
                db.productBrand.Add(productbrand);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productbrand));
        }
        public ActionResult Create(ProductCategory productcategory)
        {
            if (ModelState.IsValid)
            {
                db.productCatagory.Add(productcategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productcategory));
        }
        public ActionResult Create(Order order)
        {
            if (ModelState.IsValid)
            {
                db.orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(order));
        }
        public ActionResult Create(Occasion occasion)
        {
            if (ModelState.IsValid)
            {
                db.occasion.Add(occasion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(occasion));
        }
Ejemplo n.º 6
0
        public ActionResult Create(Cart cart)
        {
            if (ModelState.IsValid)
            {
                db.carts.Add(cart);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductinfoId = new SelectList(db.Productinfoes, "ID", "Name", cart.ProductinfoId);
            return(View(cart));
        }
Ejemplo n.º 7
0
        public ActionResult Create(Productinfo productinfo)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Name = productinfo.Name;
                db.Productinfoes.Add(productinfo);
                //Session["productinfo_Name_ID"] = productinfo.Name + productinfo.ID;
                db.SaveChanges();
                Session["productinfo_Name_ID"] = productinfo.Name + db.Productinfoes.Max(x => x.ID);

                return(RedirectToAction("PhotoUpload"));
            }

            ViewBag.ProductBrandId    = new SelectList(db.productBrand, "Id", "Brand", productinfo.ProductBrandId);
            ViewBag.ProductCategoryId = new SelectList(db.productCatagory, "Id", "Category", productinfo.ProductCategoryId);
            ViewBag.OccasionId        = new SelectList(db.occasion, "Id", "ProductOccasion", productinfo.OccasionId);
            return(View(productinfo));
        }
Ejemplo n.º 8
0
 public ActionResult RegisterView(UserAccount account)
 {
     if (ModelState.IsValid)
     {
         using (GiftDBContext db = new GiftDBContext()) {
             db.userAccount.Add(account);
             db.SaveChanges();
         }
         //ModelState.Clear();
         //ViewBag.message = account.Name+""+ "Save Succcessfully ";
         return(RedirectToAction("Index", "Productinfo"));
     }
     return(View());
 }
Ejemplo n.º 9
0
        public ActionResult AddressAndPayment(Order order)
        {
            if (ModelState.IsValid)
            {
                db.orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Complete"));
            }

            return(View());

            //var order = new Order();
            //TryUpdateModel(order);
            //try
            //{
            //    if (string.Equals(values["PromoCode"], PromoCode,
            //    StringComparison.OrdinalIgnoreCase) == false)
            //    {
            //        return View(order);
            //    }

            //    else
            //    {
            //        order.Username = User.Identity.Name;
            //        order.OrderDate = DateTime.Now;
            //        //Save Order
            //        db.orders.Add(order);
            //        db.SaveChanges();
            //        //Process the order
            //        var cart = ShoppingCart.GetCart(this.HttpContext);
            //        cart.CreateOrder(order);
            //        return RedirectToAction("Complete",
            //        new { id = order.OrderId });
            //    }
            //}
            //catch
            //{
            //    //Invalid - redisplay with errors
            //    return View(order);
            //}
        }