// // GET: /Member/Edit/5 public ActionResult Edit(int? id) { Repository repo = new Repository(); Member member = null; if (id.HasValue) { member= repo.GetById(id.Value); } return View(member); }
public ActionResult Create(Member member) { try { Repository repo = new Repository(); if (ModelState.IsValid) { repo.Insert(member); } return RedirectToAction("Index"); } catch(Exception ex) { return View(); } }
public ActionResult Edit(int id, Member member) { try { Repository repo = new Repository(); repo.Update(member); return RedirectToAction("Index"); } catch(Exception ex) { return View(); } }
// // GET: /Member/ public ActionResult Index() { Repository repo = new Repository(); IEnumerable<Member> memberList = repo.GetMembers(); return View(memberList); }