private void MapToEntity(UpdateDictionaryDetailInputModel model, DictionaryDetail entity) { entity.Id = model.Id; entity.Name = model.Name; entity.CreatedTime = model.CreatedTime; entity.SortNumber = model.SortNumber; entity.Enabled = model.Enabled; entity.Remark = model.Remark; }
public async Task <IActionResult> UpdateDictionaryDetail([FromForm] UpdateDictionaryDetailInputModel model) { var dictionaryService = Ioc.Get <IDictionaryService>(); var dictionaryDetail = await dictionaryService.GetDictionaryDetailById(model.Id); if (dictionaryDetail == null) { return(Ok(new StandardResult().Fail(StandardCode.ArgumentError, "数据字典不存在"))); } MapToEntity(model, dictionaryDetail); dictionaryDetail.ModifiedBy = CurrentUserId; dictionaryDetail.ModifiedTime = DateTime.Now; await dictionaryService.UpdateDictionaryDetailAsync(dictionaryDetail); return(Ok(new StandardResult().Succeed("更新成功"))); }