Exemplo n.º 1
0
        public ActionResult Edit(SchemeAddViewModel model)
        {
            ViewBag.MenuItem = "scheme-media";
            ServiceResult result = new ServiceResult();

            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    var entity = new Scheme();
                    entity.ID          = model.ID;
                    entity.Name        = model.Name;
                    entity.Description = model.Description;
                    SchemeService.Update(entity);
                    result.Message = "媒体方案修改成功!";
                    return(Redirect(Url.Action("index")));
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体方案修改失败!", ex);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            ViewBag.MenuItem = "scheme-media";

            var scheme = SchemeService.Find(id);

            var model = new SchemeAddViewModel()
            {
                ID          = scheme.ID,
                Name        = scheme.Name,
                Description = scheme.Description
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Add(SchemeAddViewModel model)
        {
            ViewBag.MenuItem = "scheme-add";
            ServiceResult result = new ServiceResult();

            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    var memberID = Convert.ToInt32(CookieHelper.UID);

                    Scheme entity = new Scheme()
                    {
                        Name        = model.Name,
                        Description = model.Description,
                        MemberID    = memberID,
                        AddTime     = DateTime.Now,
                        LastTime    = DateTime.Now,
                    };
                    SchemeService.Create(entity);
                    result.Message = "媒体方案保存成功!";
                    return(Redirect(Url.Action("index")));
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体方案保存失败!", ex);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Add(SchemeAddViewModel model)
        {
            ViewBag.MenuItem = "scheme-add";
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    var memberID = Convert.ToInt32(CookieHelper.UID);

                    Member_Scheme ms = new Member_Scheme()
                    {
                        Name = model.Name,
                        Description = model.Description,
                        MemberID = memberID,
                        AddTime = DateTime.Now,
                        LastTime = DateTime.Now,
                    };
                    member_SchemeService.Create(ms);
                    result.Message = "媒体方案保存成功!";
                    return Redirect(Url.Action("index"));
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return View(model);
        }
Exemplo n.º 5
0
 public ActionResult Edit(SchemeAddViewModel model)
 {
     ViewBag.MenuItem = "scheme-index";
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var scheme = new Member_Scheme();
             scheme.ID = model.ID;
             scheme.Name = model.Name;
             scheme.Description = model.Description;
             member_SchemeService.Update(scheme);
             result.Message = "媒体方案保存成功!";
             return Redirect(Url.Action("index"));
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
Exemplo n.º 6
0
        public ActionResult Edit(int id)
        {
            ViewBag.MenuItem = "scheme-index";

            var scheme = member_SchemeService.Find(id);

            var model = new SchemeAddViewModel()
            {
                ID = scheme.ID,
                Name = scheme.Name,
                Description = scheme.Description
            };

            return View(model);
        }