Пример #1
0
 public ActionResult Contact(CompanyContactInfoViewModel model)
 {
     ViewBag.MenuItem = "company-contact";
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         try
         {
             result = companyService.UpdateCompanyContact(CookieHelper.MemberID, model);
             result.Message = "联系信息保存" + (result.Success ? "成功!" : "失败!");
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     TempData["Service_Result"] = result;
     return View(model);
 }
Пример #2
0
 public ServiceResult UpdateCompanyContact(int MemberID, CompanyContactInfoViewModel model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = IncludeFind(MemberID);
         DB_Service.Attach<Company>(company);
         company.LinkMan = model.LinkMan;
         company.Fax = model.Fax;
         company.Mobile = model.Mobile;
         company.MSN = model.MSN;
         company.Phone = model.Phone;
         company.QQ = model.QQ;
         company.Sex = model.Sex;
         DB_Service.Commit();
     }
     catch (DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
Пример #3
0
 public ActionResult Contact()
 {
     ViewBag.MenuItem = "company-contact";
     var company = companyService.Find(CookieHelper.MemberID);
     var model = new CompanyContactInfoViewModel()
     {
         Fax = company.Fax,
         LinkMan = company.LinkMan,
         Mobile = company.Mobile,
         MSN = company.MSN,
         Phone = company.Phone,
         QQ = company.QQ,
         Sex = company.Sex
     };
     return View(model);
 }