|
|
@ -56,27 +56,22 @@ namespace Shentun.Peis.Sexs |
|
|
/// <param name="input">修改参数</param>
|
|
|
/// <param name="input">修改参数</param>
|
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<SexDto> UpdateAsync(char Id, UpdateSexDto input) |
|
|
|
|
|
|
|
|
public async Task<SexDto> UpdateAsync(char Id, UpdateSexDto input) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var ent = await _repository.GetAsync(m => m.Id == Id); |
|
|
var ent = await _repository.GetAsync(m => m.Id == Id); |
|
|
if (ent != null) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (DateHelper.IsNullOrEmpty(input.DisplayName)) |
|
|
|
|
|
throw new UserFriendlyException("名称不能为空"); |
|
|
|
|
|
|
|
|
if (DateHelper.IsNullOrEmpty(input.DisplayName)) |
|
|
|
|
|
throw new UserFriendlyException("名称不能为空"); |
|
|
|
|
|
|
|
|
ent.DisplayName = input.DisplayName; |
|
|
|
|
|
ent.SimpleCode = LanguageConverter.GetPYSimpleCode(input.DisplayName); |
|
|
|
|
|
|
|
|
ent.DisplayName = input.DisplayName; |
|
|
|
|
|
ent.SimpleCode = input.SimpleCode; |
|
|
|
|
|
|
|
|
|
|
|
var newent = await _repository.UpdateAsync(ent); |
|
|
|
|
|
|
|
|
|
|
|
return ObjectMapper.Map<Sex, SexDto>(newent); |
|
|
|
|
|
|
|
|
var newent = await _repository.UpdateAsync(ent); |
|
|
|
|
|
|
|
|
|
|
|
return ObjectMapper.Map<Sex, SexDto>(newent); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return ObjectMapper.Map<Sex, SexDto>(ent); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|