Пример #1
0
 public ActionResult Edit(int id)
 {
     EditModel model = new EditModel();
     Member member = memberService.FindMemberWithProfile(id);
     model.MemberID = member.MemberID;
     model.Email = member.Email;
     model.NickName = member.NickName;
     model.GroupID = member.GroupID;
     model.AvtarUrl = member.AvtarUrl;
     model.CityCode = member.Member_Profile.CityCode;
     model.Sex = member.Member_Profile.Sex;
     model.Borthday = member.Member_Profile.Borthday;
     model.Description = member.Member_Profile.Description;
     List<int> GroupList = new List<int>();
     GroupList.Add(model.GroupID);
     ViewBag.Data_GroupID = GetForeignData(GroupList);
     return View(model);
 }
Пример #2
0
 public Member Update(EditModel model)
 {
     Member member = FindMemberWithProfile(model.MemberID);
     DB_Service.Attach<Member>(member);
     member.GroupID = model.GroupID;
     member.AvtarUrl = model.AvtarUrl;
     member.Member_Profile.CityCode = model.CityCode;
     member.Member_Profile.Sex = model.Sex;
     member.Member_Profile.Borthday = model.Borthday;
     member.Member_Profile.Description = model.Description;
     DB_Service.Commit();
     return member;
 }
Пример #3
0
 public ActionResult Edit(EditModel model)
 {
     List<int> GroupList = new List<int>();
     GroupList.Add(model.GroupID);
     var groups = GetForeignData(GroupList);
     ViewBag.Data_GroupID = groups;
     if (ModelState.IsValid)
     {
         try
         {
             memberService.Update(model);
             return RedirectToAction("index");
         }
         catch (Exception ex)
         {
             ViewBag.Message = ex.Message;
             return View(model);
         }
     }
     else
     {
         return View(model);
     }
 }