public async Task <HEIEncounter> AddHeiEncounter(HEIEncounter heiEncounter) { try { await _unitOfWork.Repository <HEIEncounter>().AddAsync(heiEncounter); await _unitOfWork.SaveAsync(); return(heiEncounter); } catch (Exception e) { Log.Error(e.Message + " " + e.InnerException); throw e; } }
public async Task <Result <AddHeiDeliveryCommandResponse> > Handle(HEIDeliveryCommand request, CancellationToken cancellationToken) { using (_unitOfWork) { try { HEIEncounterService heiEncounterService = new HEIEncounterService(_unitOfWork); HEIEncounter heiEncounter = new HEIEncounter() { PatientId = request.PatientId, PatientMasterVisitId = request.PatientMasterVisitId, PlaceOfDeliveryId = request.PlaceOfDelivery, ModeOfDeliveryId = request.ModeOfDelivery, BirthWeight = request.BirthWeight, ArvProphylaxisId = request.ProphylaxisReceived, ArvProphylaxisOther = request.ProphylaxisReceivedOther, MotherRegisteredId = request.MotherIsRegistered, MotherPersonId = request.MotherPersonId, MotherStatusId = request.MotherStatusId, PrimaryCareGiverID = request.PrimaryCareGiverID, MotherName = request.MotherName, MotherCCCNumber = request.MotherCCCNumber, MotherPMTCTDrugsId = request.MotherPMTCTDrugsId, MotherPMTCTRegimenId = request.MotherPMTCTRegimenId, MotherPMTCTRegimenOther = request.MotherPMTCTRegimenOther, MotherArtInfantEnrolId = request.MotherArtInfantEnrolId, MotherArtInfantEnrolRegimenId = request.MotherArtInfantEnrolRegimenId, DeleteFlag = false, CreateDate = DateTime.Now, CreatedBy = request.CreatedBy, }; HEIEncounter heiEncounterResult = await heiEncounterService.AddHeiEncounter(heiEncounter); return(Result <AddHeiDeliveryCommandResponse> .Valid(new AddHeiDeliveryCommandResponse() { HeiEncounterId = heiEncounterResult.Id })); } catch (Exception e) { Log.Error(e.Message + " " + e.InnerException); return(Result <AddHeiDeliveryCommandResponse> .Invalid(e.Message)); } } }