예제 #1
0
        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));
        }
예제 #2
0
        public ActionResult EditCredentials(int ID)
        {
            ViewBag.MenuItem = "company-credentials";
            var member = MemberService.Find(CookieHelper.MemberID);

            if (member.Status < (int)MemberStatus.CompanyAuth)
            {
                return(Redirect(Url.Action("openbiz", "reg")));
            }
            var credentials = CompanyCredentialsImgService.Find(ID);

            if (credentials == null)
            {
                return(Content("<script>alert('非法操作!');window.history.go(-1);</script>"));
            }
            var model = new CompanyCredentialsViewModel()
            {
                ID     = credentials.ID,
                Name   = credentials.Title,
                ImgUrl = credentials.ImgUrl
            };

            return(View(model));
        }