添加SiteId
This commit is contained in:
@@ -23,6 +23,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public string CountryCN { get; set; } = String.Empty;
|
||||
public string ProvinceCN { get; set; } = String.Empty;
|
||||
public string CityCN { get; set; } = String.Empty;
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
}
|
||||
|
||||
public class HospitalQueryDTO : PageInput
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -33,6 +34,11 @@ namespace IRaCIS.Application.Services
|
||||
VerifyMsg = "已经存在同名的医院,请确认。"
|
||||
};
|
||||
|
||||
if (await _hospitalRepository.AnyAsync(x => x.SiteId == hospitalCommand.SiteId && hospitalCommand.SiteId != null))
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前Site已经添加到其他Hospital了");
|
||||
}
|
||||
|
||||
var hospital = await _hospitalRepository.InsertOrUpdateAsync(hospitalCommand, true, exp);
|
||||
|
||||
return ResponseOutput.Ok(hospital.Id.ToString());
|
||||
|
||||
Reference in New Issue
Block a user