Beispiel #1
0
        public JsonResult Edit(PlateSettingDto model)
        {
            string errs = GetModelStateError();

            if (!string.IsNullOrEmpty(errs))
            {
                return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs)));
            }
            PlateSettingDto currModel = _PlateSettingAppService.Get(model.ID);

            if (currModel == null)
            {
                return(Json(new OperateMessage <string>(OperateResult.Fail, true, "修改失败,修改的内容不存在!")));
            }
            currModel.Key              = model.Key;
            currModel.LastUpdateTime   = DateTime.Now;
            currModel.LastUpdateUserID = _currUser.ID;
            currModel.Tag              = model.Tag;
            currModel.Value            = model.Value;

            bool IsSucceed = _PlateSettingAppService.Edit(currModel);

            if (IsSucceed)
            {
                return(Json(new OperateMessage <string>("/PlateSetting/Index")));
            }
            return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "修改成功!" : "修改失败!")));
        }
Beispiel #2
0
        public JsonResult Create(PlateSettingDto model)
        {
            string errs = GetModelStateError();

            if (!string.IsNullOrEmpty(errs))
            {
                return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs)));
            }
            bool IsSucceed = _PlateSettingAppService.Create(new PlateSettingDto()
            {
                ID               = Guid.NewGuid(),
                CreateTime       = DateTime.Now,
                CreatorID        = _currUser.ID,
                Key              = model.Key,
                LastUpdateTime   = DateTime.Now,
                LastUpdateUserID = _currUser.ID,
                Tag              = model.Tag,
                Value            = model.Value,
            });

            if (IsSucceed)
            {
                return(Json(new OperateMessage <string>("/PlateSetting/Index")));
            }
            return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "添加成功!" : "添加失败!")));
        }
Beispiel #3
0
 /// <summary>
 /// edit
 /// </summary>
 /// <param name="dto"></param>
 /// <returns></returns>
 public bool Edit(PlateSettingDto dto)
 {
     try
     {
         var entity = _repository.InsertOrUpdate(Mapper.Map <PlateSetting>(dto));
         return(entity == null ? false : true);
     }
     catch (Exception ex)
     {
         _log.LogError("PlateSettingAppService Edit error occured:" + ex.Message);
         return(false);
     }
 }
Beispiel #4
0
 public IActionResult Test([FromBody] PlateSettingDto model)
 {
     _PlateSettingAppService.Create(model);
     return(Ok(""));
 }
Beispiel #5
0
        public IActionResult Edit(Guid ID)
        {
            PlateSettingDto currModel = _PlateSettingAppService.Get(ID);

            return(View(currModel));
        }