Ejemplo n.º 1
0
        public async Task <IActionResult> Get(GetImmunizationHistoryCommand immunizationHistoryCommand)
        {
            var response = await _mediator.Send(immunizationHistoryCommand, Request.HttpContext.RequestAborted);

            if (response.IsValid)
            {
                return(Ok(response.Value));
            }
            return(BadRequest(response));
        }
Ejemplo n.º 2
0
        public async Task <Result <List <Vaccination> > > Handle(GetImmunizationHistoryCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    List <Vaccination> vaccine = await _unitOfWork.Repository <Vaccination>()
                                                 .Get(x => x.PatientId == request.PatientId && x.DeleteFlag == false)
                                                 .ToListAsync(cancellationToken: cancellationToken);

                    return(Result <List <Vaccination> > .Valid(vaccine));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message + " " + e.InnerException);
                    return(Result <List <Vaccination> > .Invalid(e.Message));
                }
            }
        }