public ActionResult SavePatientMedicalAidDependancy(PatientMedicalAidDependancyViewModel model)
        {
            try
            {
                PatientMedicalAidDependancyViewModel patientMedicalAidDependancyViewModel = _IPatientMedicalAidDependancyHandler.SavePatientMedicalAidDependancy(model);

                return(Json(new { ok = true, data = patientMedicalAidDependancyViewModel }));
            }
            catch (ModelException ex)
            {
                return(Json(new { errors = ex.ModelErrors }));
            }
        }
        public PatientMedicalAidDependancyViewModel SavePatientMedicalAidDependancy(PatientMedicalAidDependancyViewModel patientMedicalAidDependancyViewModel)
        {
            PatientMedicalAidDependancyDtoResponse response = _PhekoServiceClient.SavePatientMedicalAidDependancy(_PatientMedicalAidDependancyViewModelMapper.MapToPatientMedicalAidDependancyDto(patientMedicalAidDependancyViewModel));

            if (response.HasErrors)
            {
                ModelException modelException = new ModelException();

                response.FieldErrors.ToList <FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError()
                {
                    FieldName = item.FieldName, Message = item.ErrorMessage
                }));

                throw modelException;
            }

            return(_PatientMedicalAidDependancyViewModelMapper.MapToPatientMedicalAidDependancyViewModel(response.Model));
        }
        public ActionResult DeletePatientMedicalAidDependancy(int patientMedicalAidDependancyId)
        {
            try
            {
                PatientMedicalAidDependancyViewModel model = new PatientMedicalAidDependancyViewModel()
                {
                    CrudOperation = ModelCrudOperations.Delete,
                    PatientMedicalAidDependanciesId = patientMedicalAidDependancyId
                };

                PatientMedicalAidDependancyViewModel patientMedicalAidDependancyViewModel = _IPatientMedicalAidDependancyHandler.SavePatientMedicalAidDependancy(model);

                return(Json(new { ok = true }));
            }
            catch (ModelException ex)
            {
                return(Json(new { errors = ex.ModelErrors }));
            }
        }
Esempio n. 4
0
        public PatientMedicalAidDependancyViewModel MapToPatientMedicalAidDependancyViewModel(PatientMedicalAidDependancyDto patientMedicalAidDependancyDto)
        {
            if (patientMedicalAidDependancyDto == null)
            {
                return(null);
            }

            PatientMedicalAidDependancyViewModel patientMedicalAidDependancyViewModel = new PatientMedicalAidDependancyViewModel();

            CrudOperationsMapper crudOperationsMapper = new CrudOperationsMapper();

            patientMedicalAidDependancyViewModel.PatientMedicalAidDependanciesId = patientMedicalAidDependancyDto.PatientMedicalAidDependanciesId;
            patientMedicalAidDependancyViewModel.PatientId      = patientMedicalAidDependancyDto.PatientId;
            patientMedicalAidDependancyViewModel.Title          = patientMedicalAidDependancyDto.Title;
            patientMedicalAidDependancyViewModel.FirstFullName  = patientMedicalAidDependancyDto.FirstFullName;
            patientMedicalAidDependancyViewModel.LastName       = patientMedicalAidDependancyDto.LastName;
            patientMedicalAidDependancyViewModel.MedicalAidCode = patientMedicalAidDependancyDto.MedicalAidCode;
            patientMedicalAidDependancyViewModel.BirthDate      = Converter.DateToString(patientMedicalAidDependancyDto.BirthDate);
            patientMedicalAidDependancyViewModel.Relationship   = patientMedicalAidDependancyDto.Relationship;
            patientMedicalAidDependancyViewModel.PrincipalInd   = patientMedicalAidDependancyDto.PrincipalInd;
            patientMedicalAidDependancyViewModel.CrudOperation  = crudOperationsMapper.MapToModelCrudOperations(patientMedicalAidDependancyDto.CrudOperation);

            return(patientMedicalAidDependancyViewModel);
        }