Example #1
0
 public ActionResult EditNotice(CompanyNoticeViewModel model)
 {
     ViewBag.MenuItem = "shop-notice";
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var entity = new CompanyNotice()
             {
                 MemberID = CookieHelper.MemberID,
                 Title = model.Name,
                 Content = model.Content,
                 ID = model.ID
             };
             CompanyNoticeService.Update(entity);
             result.Message = "编辑企业公告成功!";
             return RedirectToAction("Notice");
         }
         catch (Exception ex)
         {
             result.Message = "编辑企业公告失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑企业公告失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Example #2
0
 public ActionResult EditNotice(int id)
 {
     ViewBag.MenuItem = "shop-notice";
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     var notice = CompanyNoticeService.Find(id);
     if (notice == null)
     {
         return Content("<script>alert('非法操作!');window.history.go(-1);</script>");
     }
     var model = new CompanyNoticeViewModel()
     {
         ID = notice.ID,
         Name = notice.Title,
         Content = notice.Content
     };
     return View(model);
 }