Exemplo n.º 1
0
        public ActionResult AddCredentials(CompanyCredentials model)
        {
            ViewBag.MenuItem = "company-credentials";
            var member = memberService.Find(CookieHelper.MemberID);
            if (member.Status < (int)MemberStatus.CompanyAuth)
            {
                return Redirect(Url.Action("openbiz", "register"));
            }
            ServiceResult result = new ServiceResult();
            if (ModelState.IsValid)
            {

                result = companyService.SaveCompanyCredentials(CookieHelper.MemberID, model);
                result.Message = "添加证书" + (result.Success ? "成功!" : "失败!");
                TempData["Service_Result"] = result;
                if (result.Success)
                {
                    return RedirectToAction("Credentials");
                }
                else
                {
                    return View(model);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return View(model);
        }
Exemplo n.º 2
0
 public ServiceResult UpdateCompanyCredentials(int MemberID, CompanyCredentials credentials)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var companyCredentials = GetCompanyCredentialsSingle(credentials.ID);
         DB_Service.Attach<CompanyCredentialsImg>(companyCredentials);
         companyCredentials.ImgUrl = credentials.Url;
         companyCredentials.Title = credentials.Name;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
Exemplo n.º 3
0
 public ServiceResult SaveCompanyCredentials(int MemberID, CompanyCredentials credentials)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = DB_Service.Set<Company>().Include(x => x.CompanyCredentialsImg).Single(x => x.MemberID == MemberID);
         DB_Service.Attach<Company>(company);
         CompanyCredentialsImg cimg = new CompanyCredentialsImg()
         {
             ImgUrl = credentials.Url,
             MemberID = MemberID,
             Title = credentials.Name
         };
         company.CompanyCredentialsImg.Add(cimg);
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
Exemplo n.º 4
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", "register"));
            }

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