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