Пример #1
0
 public ActionResult Avtar(AvtarModel model)
 {
     ViewBag.MenuItem = "avtar";
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             memberService.SaveMemberAvtar(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);
 }
Пример #2
0
 public void SaveMemberAvtar(int MemberID, AvtarModel model)
 {
     Member member = Find(MemberID);
     DB_Service.Attach<Member>(member);
     member.AvtarUrl = model.AvtarUrl;
     DB_Service.Commit();
     SetLoginCookie(member);
 }
Пример #3
0
 public ActionResult Avtar()
 {
     ViewBag.MenuItem = "avtar";
     var memberID = Convert.ToInt32(CookieHelper.UID);
     Member member = memberService.Find(memberID);
     AvtarModel pm = new AvtarModel()
     {
         MemberID = member.MemberID,
         AvtarUrl = member.AvtarUrl ?? Url.Content(ConfigSetting.Default_AvtarUrl)
     };
     return View(pm);
 }