public async Task <IActionResult> Post([FromBody] AddHeiPatientIptWorkupCommand addHeiPatientIptWorkupCommand) { var response = await _mediator.Send(addHeiPatientIptWorkupCommand, Request.HttpContext.RequestAborted); if (response) { return(Ok(response.Value)); } return(BadRequest(response.Value)); }
public async Task <Result <PatientIptWorkup> > Handle(AddHeiPatientIptWorkupCommand request, CancellationToken cancellationToken) { using (_unitOfWork) { try { await _unitOfWork.Repository <PatientIptWorkup>().AddAsync(request.PatientIptWorkup); await _unitOfWork.SaveAsync(); return(Result <PatientIptWorkup> .Valid(request.PatientIptWorkup)); } catch (Exception e) { Log.Error(e.Message + " " + e.InnerException); return(Result <PatientIptWorkup> .Invalid(e.Message)); } } }