public ActionResult Create(Material material) { if (ModelState.IsValid) { _materialDbContext.dbSet.Add(material); _materialDbContext.SaveChanges(); return RedirectToAction("Index"); } return View(material); }
public ActionResult Edit(Material material) { if (ModelState.IsValid) { _materialDbContext.Entry(material).State = EntityState.Modified; _materialDbContext.SaveChanges(); return RedirectToAction("Index"); } return View(material); }