public ActionResult Create(Tool tool) { if (ModelState.IsValid) { ProviderContext.Tools.Add(tool); ProviderContext.SaveChanges(); return RedirectToAction("Index"); } return View(tool); }
public ActionResult Create() { var model = new Tool(); return View(model); }
public ActionResult Edit(Tool tool) { if (ModelState.IsValid) { ProviderContext.Entry(tool).State = EntityState.Modified; ProviderContext.SaveChanges(); return RedirectToAction("Index"); } return View(tool); }