Пример #1
0
 public ActionResult Contact(ContactModel model)
 {
     ViewBag.MenuItem = "contact";
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             memberService.SaveMemberContact(memberID, model);
             result.Message = "联系信息保存成功!";
             TempData["Service_Result"] = result;
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
Пример #2
0
        public ActionResult Add(OutDoorViewModel model)
        {
            ViewBag.MenuItem = "outdoor-publish";
            ServiceResult result = new ServiceResult();
            var AreaAttArray = new List<int>();
            if (!ModelState.IsValid)
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
            }
            else
            {
                try
                {
                    AreaAttArray = model.AreaAtt.Split(',').Select(x => Convert.ToInt32(x)).ToList();
                    outDoorService.Create(model);
                    result.Message = "添加户外成功!";
                    TempData["Service_Result"] = result;
                    return RedirectToAction("preverify");

                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                }

            }
            ViewBag.Data_AreaAtt = areaAttService.GetSelectList(AreaAttArray);
            return View(model);
        }
Пример #3
0
 public ServiceResult Update(OutDoorMediaCate model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var target = Find(model.ID);
         DB_Service.Attach<OutDoorMediaCate>(target);
         target.CateName = model.CateName;
         target.CateCode = model.CateCode;
         target.PCateCode = model.PCateCode;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }