public ActionResult Delete(Products model) { var silinen = (from product in ent.Products where product.id == model.id select product).First(); ent.Products.Remove(silinen); ent.SaveChanges(); return RedirectToAction("Index"); }
public ActionResult Create(Products model) { Products p = new Products(); p.Name = model.Name; p.CategoryID = model.CategoryID; p.UnitsInStock = model.UnitsInStock; p.Price = model.Price; ent.Products.Add(p); ent.SaveChanges(); return RedirectToAction("Index"); }
public ActionResult Edit(Products model) { var degisen = (from product in ent.Products where product.id == model.id select product).First(); degisen.Name = model.Name; degisen.CategoryID = model.CategoryID; degisen.Price = model.Price; degisen.UnitsInStock = model.UnitsInStock; ent.SaveChanges(); return RedirectToAction("Index"); }