public ActionResult Edit(int id, UserVM vm) { try { // TODO: Add update logic here var locSource = vms.Where(i => i.Id == id).SingleOrDefault(); locSource.Username = vm.Username; return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(UserVM vm) { try { var id = vms.OrderByDescending(i => i.Id).Select(i => i.Id).FirstOrDefault(); vm.Id = ++id; vms.Add(vm); return RedirectToAction("Index"); } catch { return View(); } }