public AbstractDomainModel GetAll(SearchCriteriaEnum searchCriteria)
        {
            DomainModel.Models.EditProfile editProfile = new DomainModel.Models.EditProfile();

            switch (searchCriteria)
            {
            case CareHub.Core.Enumerations.SearchCriteriaEnum.GET_COUNTRIES:
                editProfile.Countries = countryRepository.GetAll();
                break;

            case CareHub.Core.Enumerations.SearchCriteriaEnum.GET_STATES:
                editProfile.States = stateRepository.GetAll();
                break;

            case CareHub.Core.Enumerations.SearchCriteriaEnum.GET_CITIES:
                editProfile.Cities = cityRepository.GetAll();
                break;

            case CareHub.Core.Enumerations.SearchCriteriaEnum.GET_LOCALITIES:
                editProfile.Localities = localityRepository.GetAll();
                break;

            default:
                break;
            }
            return(editProfile);
        }
        public AbstractDomainModel Get(AbstractDomainModel domainModel)
        {
            DomainModel.Models.EditProfile    editProfile = (DomainModel.Models.EditProfile)domainModel;
            CareHub.DataModel.Models.Provider provider    = new CareHub.DataModel.Models.Provider();
            provider = providerRepository.GetProviderByUserId(editProfile.UserId);
            editProfile.ProviderId = provider.ProviderId;
            editProfile.FirstName  = provider.FirstName;
            editProfile.LastName   = provider.LastName;
            editProfile.Gender     = provider.GenderId;
            editProfile.Email      = provider.Email;
            //editProfile.CountryName = countryRepository.GetNameById(provider.CountryId)
            editProfile.TimeZone     = provider.TimeZone;
            editProfile.MobileNumber = provider.MobileNumber;
            //editProfile.CountryId = provider.CountryId;
            //editProfile.CityId = provider.CityId;
            //editProfile.LocalityId = provider.LocalityId;
            editProfile.ZipCode = provider.ZipCode;

            return(editProfile);
        }
        public override AbstractDomainModel Update(AbstractDomainModel domainModel, CareHub.Factory.Enumerations.DomainModelEnum domainModelType)
        {
            DomainModel.Models.ChangePassword changePassword = (DomainModel.Models.ChangePassword)domainModel;
            DomainModel.Models.ForgotPassword forgotPassword = (DomainModel.Models.ForgotPassword)domainModel;
            DomainModel.Models.EditProfile    editProfile    = (DomainModel.Models.EditProfile)domainModel;
            try
            {
                if (domainModel != null)
                {
                    switch (domainModelType)
                    {
                    case CareHub.Factory.Enumerations.DomainModelEnum.CHANGE_PASSWORD:
                        if (changePassword.CurrentPassword == null || changePassword.CurrentPassword.Length <= 0)
                        {
                            changePassword.ResponseMessage = "Current password is required.";
                        }
                        else if (changePassword.NewPassword == null || changePassword.NewPassword.Length <= 0)
                        {
                            changePassword.ResponseMessage = "New password is required.";
                        }
                        else
                        {
                            FactoryFacade factory = new FactoryFacade();
                            unitOfWork = factory.UnitOfWorkFactory.CreateUnitOfWork(typeof(CareHub.UnitOfWork.ChangePasswordUOW));
                            unitOfWork.Update(changePassword);
                            unitOfWork.Commit();
                            CareHub.Core.ConfigurationEmails.ConfigurationEmail.ChangePasswordEmail(changePassword.UserId, changePassword.NewPassword, changePassword.UserId);
                            changePassword.ResponseMessage = "Password changed successfully";
                        }
                        break;

                    case CareHub.Factory.Enumerations.DomainModelEnum.FORGOT_PASSWORD:
                        //  if (forgotPassword.CurrentPassword == null || forgotPassword.CurrentPassword.Length <= 0)
                        // { message = "Current password is required"; }
                        if (forgotPassword.NewPassword == null || forgotPassword.NewPassword.Length <= 0)
                        {
                            forgotPassword.ResponseMessage = "New password is required";
                        }
                        else
                        {
                            FactoryFacade factory = new FactoryFacade();
                            unitOfWork = factory.UnitOfWorkFactory.CreateUnitOfWork(typeof(CareHub.UnitOfWork.ForgotPasswordUOW));
                            unitOfWork.Update(forgotPassword);
                            unitOfWork.Commit();

                            /*  DomainModel.Models.ProviderRegistration providerRegistration = new DomainModel.Models.ProviderRegistration();
                             * unitOfWork = factory.UnitOfWorkFactory.CreateUnitOfWork(typeof(CareHub.UnitOfWork.ProviderRegistrationUOW));
                             * providerRegistration = (DomainModel.Models.ProviderRegistration)unitOfWork.Get(providerRegistration);
                             */
                            CareHub.Core.ConfigurationEmails.ConfigurationEmail.ForgotPasswordEmail(forgotPassword.UserId, forgotPassword.NewPassword, forgotPassword.UserId);
                            forgotPassword.ResponseMessage = "New password has been sent successfully";
                        }
                        break;

                    case CareHub.Factory.Enumerations.DomainModelEnum.EDIT_PROFILE:
                        if (editProfile.FirstName == null || editProfile.FirstName.Length <= 0)
                        {
                            editProfile.ResponseMessage = "First name is required.";
                        }
                        else if (editProfile.Gender == 0)
                        {
                            editProfile.ResponseMessage = "Gender is required.";
                        }
                        else if (editProfile.CountryId == 0)
                        {
                            editProfile.ResponseMessage = "Country is required.";
                        }
                        else if (editProfile.StateId == 0)
                        {
                            editProfile.ResponseMessage = "State is required.";
                        }
                        else if (editProfile.CityId == 0)
                        {
                            editProfile.ResponseMessage = "City is required.";
                        }
                        else if (editProfile.LocalityId == 0)
                        {
                            editProfile.ResponseMessage = "Locality is required.";
                        }
                        else
                        {
                            /////////
                            FactoryFacade factory = new FactoryFacade();
                            unitOfWork = factory.UnitOfWorkFactory.CreateUnitOfWork(typeof(CareHub.UnitOfWork.ChangePasswordUOW));
                            unitOfWork.Update(editProfile);
                            unitOfWork.Commit();
                            editProfile.ResponseMessage = "Profile updated successfully.";
                        }
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (domainModelType)
                    {
                    case CareHub.Factory.Enumerations.DomainModelEnum.CHANGE_PASSWORD:
                        changePassword.ResponseMessage = "Invalid domain model.";
                        break;

                    case CareHub.Factory.Enumerations.DomainModelEnum.FORGOT_PASSWORD:
                        forgotPassword.ResponseMessage = "Invalid domain model.";
                        break;

                    case CareHub.Factory.Enumerations.DomainModelEnum.EDIT_PROFILE:
                        editProfile.ResponseMessage = "Invalid domain model.";
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                switch (domainModelType)
                {
                case CareHub.Factory.Enumerations.DomainModelEnum.CHANGE_PASSWORD:
                    changePassword.ResponseMessage = ex.Message;
                    break;

                case CareHub.Factory.Enumerations.DomainModelEnum.FORGOT_PASSWORD:
                    forgotPassword.ResponseMessage = ex.Message;
                    break;

                case CareHub.Factory.Enumerations.DomainModelEnum.EDIT_PROFILE:
                    editProfile.ResponseMessage = ex.Message;
                    break;

                default:
                    break;
                }
            }
            switch (domainModelType)
            {
            case CareHub.Factory.Enumerations.DomainModelEnum.CHANGE_PASSWORD:
                return(changePassword);

            case CareHub.Factory.Enumerations.DomainModelEnum.FORGOT_PASSWORD:
                return(forgotPassword);

            case CareHub.Factory.Enumerations.DomainModelEnum.EDIT_PROFILE:
                return(editProfile);

            default:
                break;
            }
            return(null);
        }