Пример #1
0
        public ActionResult Contact()
        {
            ViewBag.MenuItem = "contact";
            var memberID = Convert.ToInt32(CookieHelper.UID);
            Member member = memberService.FindMemberWithProfile(memberID);
            if (member.Member_Profile == null)
            {
                member.Member_Profile = new Member_Profile();
            }

            ContactModel cm = new ContactModel()
            {
                MemberID = member.MemberID,
                Address = member.Member_Profile.Address,
                Email = member.Email,
                Mobile = member.Member_Profile.Mobile,
                Phone = member.Member_Profile.Phone,
                MSN = member.Member_Profile.MSN,
                Position = member.Member_Profile.Lat + "|" + member.Member_Profile.Lng,
                QQ = member.Member_Profile.QQ

            };
            return View(cm);
        }
Пример #2
0
 public ActionResult Contact(ContactModel model)
 {
     ViewBag.MenuItem = "contact";
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             memberService.SaveMemberContact(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);
 }
Пример #3
0
 public void SaveMemberContact(int MemberID, ContactModel 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 = member.MemberID;
     mp.Address = model.Address;
     mp.Phone = model.Phone;
     mp.Mobile = model.Mobile;
     mp.MSN = model.MSN;
     mp.QQ = model.QQ;
     if (model.Position.IndexOf("|") != -1)
     {
         mp.Lat = Convert.ToDouble(model.Position.Split('|')[0]);
         mp.Lng = Convert.ToDouble(model.Position.Split('|')[1]);
     }
     member.Member_Profile = mp;
     DB_Service.Commit();
 }