示例#1
0
 //
 // 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);
 }
示例#2
0
        public ActionResult Create(Member member)
        {
            try
            {
                Repository repo = new Repository();
                if (ModelState.IsValid)
                {
                    repo.Insert(member);
                }

                return RedirectToAction("Index");
            }
            catch(Exception ex)
            {
                return View();
            }
        }
示例#3
0
        public ActionResult Edit(int id, Member member)
        {
            try
            {
             Repository repo = new Repository();
             repo.Update(member);

                return RedirectToAction("Index");
            }
            catch(Exception ex)
            {
                return View();
            }
        }
示例#4
0
 //
 // GET: /Member/
 public ActionResult Index()
 {
     Repository repo = new Repository();
     IEnumerable<Member> memberList = repo.GetMembers();
     return View(memberList);
 }