public ActionResult BaseInfo() { ViewBag.MenuItem = "baseinfo"; var memberID = Convert.ToInt32(CookieHelper.UID); Member member = memberService.FindMemberWithProfile(memberID); if (member.Member_Profile == null) { member.Member_Profile = new Member_Profile(); } ProfileModel pm = new ProfileModel() { MemberID = member.MemberID, Borthday = member.Member_Profile.Borthday, Description = member.Member_Profile.Description, NickName = member.NickName, RealName = member.Member_Profile.RealName, CityCode = member.Member_Profile.CityCode, Sex = member.Member_Profile.Sex }; return View(pm); }
public ActionResult BaseInfo(ProfileModel model) { ViewBag.MenuItem = "baseinfo"; ServiceResult result = new ServiceResult(); if (ModelState.IsValid) { try { var memberID = Convert.ToInt32(CookieHelper.UID); memberService.SaveMemberBaseInfo(memberID, model); result.Message = "基本信息保存成功!"; TempData["Service_Result"] = result; } catch (Exception ex) { result.Message = Utilities.GetInnerMostException(ex); result.AddServiceError(result.Message); } } else { result.Message = "表单输入有误!"; result.AddServiceError("表单输入有误!"); } return View(model); }
public void SaveMemberBaseInfo(int MemberID, ProfileModel model) { Member member = FindMemberWithProfile(MemberID); DB_Service.Attach<Member>(member); Member_Profile mp = new Member_Profile(); if (member.Member_Profile != null) { mp = member.Member_Profile; } mp.MemberID = model.MemberID; mp.Borthday = model.Borthday; mp.CityCode = model.CityCode; mp.Description = model.Description; member.NickName = model.NickName; mp.RealName = model.RealName; mp.Sex = model.Sex; member.Member_Profile = mp; DB_Service.Commit(); SetLoginCookie(member); }