Ejemplo n.º 1
0
        public async Task <IActionResult> GetIpt([FromBody] GetHeiPatientIptCommand getHeiPatientIptCommand)
        {
            var response = await _mediator.Send(getHeiPatientIptCommand, Request.HttpContext.RequestAborted);

            if (response)
            {
                return(Ok(response.Value));
            }
            return(BadRequest(response.Value));
        }
        public async Task <Result <List <PatientIpt> > > Handle(GetHeiPatientIptCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    List <PatientIpt> patientIpt = await _unitOfWork.Repository <PatientIpt>()
                                                   .Get(x => x.PatientId == request.PatientId && !x.DeleteFlag).ToListAsync();

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