コード例 #1
0
 public void Update(CompanyCredentialsImg model)
 {
     var target = Find(model.ID);
     db.Attach<CompanyCredentialsImg>(target);
     target.ImgUrl = model.ImgUrl;
     target.Title = model.Title;
     db.Commit();
 }
コード例 #2
0
ファイル: BizController.cs プロジェクト: navy235/7980Site
        public ActionResult AddCredentials(CompanyCredentialsViewModel model)
        {
            ViewBag.MenuItem = "company-credentials";
            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 CompanyCredentialsImg()
                    {
                        ImgUrl = model.ImgUrl,
                        Title = model.Name,
                        MemberID = CookieHelper.MemberID
                    };

                    CompanyCredentialsImgService.Create(entity);
                    result.Message = "添加证书成功!";

                    return RedirectToAction("Credentials");
                }
                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(CompanyCredentialsImg model)
 {
     var target = Find(model.ID);
     db.Remove<CompanyCredentialsImg>(target);
     db.Commit();
 }
コード例 #4
0
 public void Create(CompanyCredentialsImg model)
 {
     db.Add<CompanyCredentialsImg>(model);
     db.Commit();
 }