Exemple #1
0
        public async Task HandleAsync(RemoveAcceptedMedicalScheme command, ICorrelationContext context)
        {
            AcceptedMedicalScheme acceptedScheme = await _medSchemeRepo.GetAsync(command.Id);

            if (acceptedScheme == null)
            {
                throw new MedParkException("accepted_scheme_does_not_exist", $"The accepted scheme {command.Id} does not exist.");
            }

            await _medSchemeRepo.DeleteAsync(command.Id);
        }
Exemple #2
0
        public async Task HandleAsync(UpdatePracticeAcceptedMedicalScheme command, ICorrelationContext context)
        {
            AcceptedMedicalScheme acceptedScheme = await _acceptedSchemesRepo.GetAsync(x => x.Id == command.Id);

            if (acceptedScheme == null)
            {
                throw new MedParkException($"Accepted scheme ({command.Id}) does not exist.");
            }

            //Update values
            acceptedScheme.SchemeId      = command.SchemeId;
            acceptedScheme.SchemeName    = command.SchemeName;
            acceptedScheme.DateEffective = command.DateEffective;
            acceptedScheme.DateEnd       = command.DateEnd;
            acceptedScheme.IsActive      = command.IsActive;

            acceptedScheme.UpdatedModifiedDate();

            //Save updated accepted medical scheme for medical practice
            await _acceptedSchemesRepo.UpdateAsync(acceptedScheme);
        }
        public async Task HandleAsync(AddPracticeAcceptedMedicalScheme command, ICorrelationContext context)
        {
            MedicalScheme selectedScheme = await _schemesRepo.GetAsync(command.SchemeId);

            if (selectedScheme == null)
            {
                throw new MedParkException($"Invalid medical scheme Id ({command.SchemeId}) for new accepted scheme.");
            }

            AcceptedMedicalScheme acceptedScheme = new AcceptedMedicalScheme(command.Id)
            {
                PracticeId    = command.PracticeId,
                SchemeId      = command.SchemeId,
                SchemeName    = command.SchemeName,
                DateEffective = command.DateEffective,
                DateEnd       = command.DateEnd,
                IsActive      = command.IsActive
            };

            //Save accepted medical scheme for medical practice
            await _acceptedSchemesRepo.AddAsync(acceptedScheme);
        }
Exemple #4
0
        public async Task <AcceptedMedicalSchemeDTO> HandleAsync(AcceptedMedicalSchemeQuery query)
        {
            AcceptedMedicalScheme ams = await _medSchemeRepo.GetAsync(query.PracticeId);

            return(_mapper.Map <AcceptedMedicalSchemeDTO>(ams));
        }