Esempio n. 1
0
        public ActionResult Create([Bind(Include = "ID,Name,Email,Question")] Query query)
        {
            if (ModelState.IsValid)
            {
                db.Queries.Add(query);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(query));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "ID,CatName,CatDescription")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
 public bool Insert(OrderDetail detail)
 {
     try
     {
         db.OrderDetails.Add(detail);
         db.SaveChanges();
         return(true);
     }catch (Exception e)
     {
         return(false);
     }
 }
        public ActionResult Create([Bind(Include = "ID,Name,Make,Price,CategoryId")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "ID", "CatName", product.CategoryId);
            return(View(product));
        }
Esempio n. 5
0
 public int Insert(Order order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
     return(order.ID);
 }
Esempio n. 6
0
 public int Insert(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Esempio n. 7
0
 public int Insert(Product entity)
 {
     db.Products.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }