Example #1
0
        public ActionResult Create(MediaRequireViewModel model)
        {
            ServiceResult result = new ServiceResult();
            if (ModelState.IsValid)
            {
                try
                {
                    MediaRequireService.Create(model);
                    result.Message = "添加MediaRequire成功!";
                    LogHelper.WriteLog("添加MediaRequire成功");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加MediaRequire错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }

            return Json(result);
        }
Example #2
0
 public MediaRequire Create(MediaRequireViewModel model)
 {
     var entity = new MediaRequire();
     entity.CompanyID=model.CompanyID;
     entity.Name=model.Name;
     entity.Description=model.Description;
     entity.AttachmentPath=model.AttachmentPath;
     entity.DepartmentID=model.DepartmentID;
     entity.SenderID=model.SenderID;
     entity.ResolveID=model.ResolveID;
     entity.IsRoot=model.IsRoot;
     entity.PID=model.PID;
     entity.Status=model.Status;
     entity.AddUser=model.AddUser;
     entity.AddTime=model.AddTime;
     db.Add<MediaRequire>(entity);
     db.Commit();
     return entity;
 }
Example #3
0
        public ActionResult Edit(int ID)
        {
            var entity = MediaRequireService.GetALL().Single(x => x.ID == ID);

            var model = new MediaRequireViewModel()
            {
               ID = entity.ID,

               CompanyID = entity.CompanyID,

               Name = entity.Name,

               Description = entity.Description,

               AttachmentPath = entity.AttachmentPath,

               DepartmentID = entity.DepartmentID,

               SenderID = entity.SenderID,

               ResolveID = entity.ResolveID,

               IsRoot = entity.IsRoot,

               PID = entity.PID,

               Status = entity.Status,

               AddUser = entity.AddUser,

               AddTime = entity.AddTime,

            };

            return PartialView(model);
        }
Example #4
0
 public ActionResult Create()
 {
     var model = new MediaRequireViewModel();
     return PartialView(model);
 }