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