コード例 #1
0
        public async Task <Result <PatientIptOutcome> > Handle(EditHeiPatientIptOutcomeCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    PatientIptOutcome patientIptOutcome = _unitOfWork.Repository <PatientIptOutcome>().Get(x =>
                                                                                                           x.PatientId == request.PatientIptOutcome.PatientId && x.Id == request.PatientIptOutcome.Id)
                                                          .FirstOrDefault();
                    if (patientIptOutcome != null)
                    {
                        patientIptOutcome.IptEvent = request.PatientIptOutcome.IptEvent;
                        patientIptOutcome.ReasonForDiscontinuation = request.PatientIptOutcome.ReasonForDiscontinuation;
                        _unitOfWork.Repository <PatientIptOutcome>().Update(patientIptOutcome);
                        await _unitOfWork.SaveAsync();
                    }

                    return(Result <PatientIptOutcome> .Valid(patientIptOutcome));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message + " " + e.InnerException);
                    return(Result <PatientIptOutcome> .Invalid(e.Message));
                }
            }
        }
コード例 #2
0
        public async Task <IActionResult> Put([FromBody] EditHeiPatientIptOutcomeCommand editHeiPatientIptOutcomeCommand)
        {
            var response = await _mediator.Send(editHeiPatientIptOutcomeCommand, Request.HttpContext.RequestAborted);

            if (response)
            {
                return(Ok(response.Value));
            }
            return(BadRequest(response.Value));
        }
コード例 #3
0
        public async Task <Result <PatientIptOutcome> > Handle(EditHeiPatientIptOutcomeCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    PatientIptOutcome patientIptOutcome = await _unitOfWork.Repository <PatientIptOutcome>()
                                                          .Get(x => x.PatientId == request.PatientIptOutcome.PatientId && !x.DeleteFlag).FirstOrDefaultAsync();

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