添加SiteId

This commit is contained in:
he
2023-01-09 10:54:05 +08:00
parent df0f50187e
commit 7dec6bbc1a
4 changed files with 24 additions and 1 deletions
@@ -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());