コード例 #1
0
        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));
        }
コード例 #2
0
        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));
                }
            }
        }