Esempio n. 1
0
        public async Task <IActionResult> Edit(UpdateWebConfigDto model)
        {
            if (!ModelState.IsValid)
            {
                return(Operation(false, GetErrorFromModelStateStr()));
            }
            var r = await WebConfigApp.UpdateAsync(model, await CurrentUser());

            return(Json(r));
        }
Esempio n. 2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entityDto"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <R> UpdateAsync(UpdateWebConfigDto entityDto, CurrentUser currentUser)
        {
            var entity = await WebConfigAppRep.FindSingleAsync(o => o.Id == entityDto.Id);

            if (entity == null)
            {
                return(R.Err(msg: "数据不存在"));
            }
            var isExist = await WebConfigAppRep.Find(o => o.ConfigKey == entityDto.ConfigKey && o.Id != entityDto.Id).AnyAsync();

            if (isExist)
            {
                return(R.Err("key已存在"));
            }
            var dto = entityDto.MapToMeg <UpdateWebConfigDto, WebConfig>(entity);
            await WebConfigAppRep.UpdateAsync(dto);

            return(R.Suc());
        }
 public async Task <ResultDto> UpdateAsync([FromBody] UpdateWebConfigDto model)
 {
     return(await _webConfigApp.UpdateAsync(model, new Core.CurrentUser()));
 }