更新区域
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Ewide.Core.Service.Area
|
||||
public async Task AddAreaCode(AreaCodeInput input)
|
||||
{
|
||||
CheckInput(input);
|
||||
CheckCode(input);
|
||||
CheckArea(input);
|
||||
await _areaCodeRep.InsertNowAsync(input.Adapt<SysAreaCode>());
|
||||
await _sysCacheService.SetAreaCode(await _areaCodeRep.DetachedEntities.ToListAsync());
|
||||
@@ -138,5 +139,15 @@ namespace Ewide.Core.Service.Area
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckCode(AreaCodeInput input)
|
||||
{
|
||||
var any = _areaCodeRep.DetachedEntities.Any(p => p.Code == input.Code);
|
||||
if (any)
|
||||
{
|
||||
throw Oops.Oh("编码重复");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user