public ActionResult Create(Part part) { try { PartDataService.Parts.Add(part); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, Part part) { try { // Totally hacky but this is an example PartDataService.Parts.Remove(PartDataService.Parts.Find(x => x.Id == id)); PartDataService.Parts.Add(part); return RedirectToAction("Index"); } catch { return View(); } }