Add Field to Command Table

This commit is contained in:
Suphonchai Phoonsawat 2023-07-28 10:53:03 +07:00
parent 9a2e487d8d
commit 297b1efb57
6 changed files with 12061 additions and 1 deletions

View file

@ -1,6 +1,7 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Commands.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Application.Repositories.Commands
{
@ -26,7 +27,26 @@ namespace BMA.EHR.Application.Repositories.Commands
#region " Methods "
public async Task<List<CommandReceiver>> GetReceiverByCommmandIdAsync(Guid Id)
{
try
{
var command = await _dbContext.Set<Command>()
.Include(x => x.Receivers)
.FirstOrDefaultAsync(x => x.Id == Id);
if(command == null)
{
return new List<CommandReceiver>();
}
else
return command.Receivers;
}
catch
{
throw;
}
}
#endregion