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

            }

            return Json(result);
        }
Exemplo n.º 2
0
 public ActionResult Create()
 {
     var model = new ActionViewModel();
     ViewBag.Data_ControllerID = Utilities.GetSelectListData(
         ControllerService.GetALL(), x => x.ID, x => x.Name);
     return PartialView(model);
 }
Exemplo n.º 3
0
 public Models.Action Update(ActionViewModel model)
 {
     var entity = Find(model.ID);
     db.Attach<Models.Action>(entity);
     entity.ControllerID = model.ControllerID;
     entity.Name = model.Name;
     entity.Description = model.Description;
     db.Commit();
     return entity;
 }
Exemplo n.º 4
0
 public Models.Action Create(ActionViewModel model)
 {
     var entity = new Models.Action();
     entity.ControllerID = model.ControllerID;
     entity.Name = model.Name;
     entity.Description = model.Description;
     db.Add<Models.Action>(entity);
     db.Commit();
     return entity;
 }
Exemplo n.º 5
0
 public ActionResult Edit(int ID)
 {
     var entity = ActionService.Find(ID);
     var model = new ActionViewModel()
     {
         ID = entity.ID,
         Description = entity.Description,
         Name = entity.Name,
         ControllerID = entity.ControllerID
     };
     ViewBag.Data_ControllerID = Utilities.GetSelectListData(
        ControllerService.GetALL(), x => x.ID, x => x.Name, model.ControllerID);
     return PartialView(model);
 }