示例#1
0
 public void Update(CompanyNotice model)
 {
     var target = Find(model.ID);
     db.Attach<CompanyNotice>(target);
     target.Content = model.Content;
     target.Title = model.Title;
     db.Commit();
 }
示例#2
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);
 }
示例#3
0
 public void Delete(CompanyNotice model)
 {
     var target = Find(model.ID);
     db.Remove<CompanyNotice>(target);
     db.Commit();
 }
示例#4
0
 public void Create(CompanyNotice model)
 {
     db.Add<CompanyNotice>(model);
     db.Commit();
 }