public ActionResult Create([Bind(Include = "Id,Name,Price,Quantity,Description,Image,CategoryId,CreatedDate,ModifiedDate,Deleted,TabIndex,PromotionId")] Product product) { if (ModelState.IsValid) { db.Products.Add(product); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId); ViewBag.PromotionId = new SelectList(db.Promotions, "Id", "Name", product.PromotionId); return(View(product)); }
public void Register(User user) { db.Users.Add(user); db.SaveChanges(); }
public void CreateProduct(Product product) { db.Products.Add(product); db.SaveChanges(); }