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)); }
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)); }
public int Insert(Order order) { db.Orders.Add(order); db.SaveChanges(); return(order.ID); }
public int Insert(User entity) { db.Users.Add(entity); db.SaveChanges(); return(entity.ID); }
public int Insert(Product entity) { db.Products.Add(entity); db.SaveChanges(); return(entity.ID); }