Beispiel #1
0
        public ActionResult AddProduct(Products p1)
        {
            var ctg = db.Category.Where(m => m.CategoryID == p1.Category1.CategoryID).FirstOrDefault();

            p1.Category1 = ctg;
            db.Products.Add(p1);
            db.SaveChanges();
            return(RedirectToAction("Index", "Product"));
        }
 public ActionResult NewCategory(Category p1)
 {
     if (!ModelState.IsValid)
     {
         return(View("NewCategory"));
     }
     ct.Category.Add(p1);
     ct.SaveChanges();
     return(View());
 }
        public ActionResult Order()
        {
            Payements payement = new Payements();

            foreach (var ıtem in (List <Item>)Session["cart"])
            {
                var item = Convert.ToInt32(ıtem.Product.ProductID);

                db.SaveChanges();
            }
            return(View("Index"));
        }
Beispiel #4
0
 public ActionResult AddOrEdit(User userModel)
 {
     using (eCOMMERCEDYEEntities user = new eCOMMERCEDYEEntities())
     {
         if (user.User.Any(x => x.UserName == userModel.UserName))
         {
             ViewBag.DuplicateMessage = "Username already exist";
             return(View("AddOrEdit", userModel));
         }
         user.User.Add(userModel);
         user.SaveChanges();
     }
     ModelState.Clear();
     ViewBag.SuccesMessage = "Registiration confirmed";
     return(View("AddOrEdit", new User()));
 }