Exemple #1
0
        public async Task <Logic.Enums.AvailiabilityEnum> CheckEmailAvailiability(Logic.Models.AvailiabilityInput emailAddressToCheck)
        {
            if (string.IsNullOrEmpty(emailAddressToCheck.EntityToCheck) || string.IsNullOrEmpty(emailAddressToCheck.EntityToCheck.Trim()))
            {
                return(Logic.Enums.AvailiabilityEnum.None);
            }

            Logic.Providers.UserProvider provider = new Logic.Providers.UserProvider();
            try
            {
                var result = await provider.CheckEmailAlreadyRegistered(_connectionUtility, emailAddressToCheck.EntityToCheck);

                if (result)
                {
                    return(Logic.Enums.AvailiabilityEnum.NotAvailable);
                }

                return(Logic.Enums.AvailiabilityEnum.Available);
            }
            catch {
                return(Logic.Enums.AvailiabilityEnum.Unknown);
            }
        }
Exemple #2
0
        public async Task <Logic.Enums.AvailiabilityEnum> CheckDisplayNameAvaliability(Logic.Models.AvailiabilityInput displayName)
        {
            if (string.IsNullOrEmpty(displayName.EntityToCheck) || string.IsNullOrEmpty(displayName.EntityToCheck.Trim()))
            {
                return(Logic.Enums.AvailiabilityEnum.None);
            }

            Logic.Providers.UserProvider provider = new Logic.Providers.UserProvider();
            try
            {
                var result = await provider.CheckDisplayNameAlreadyUsed(_connectionUtility, displayName.EntityToCheck);

                if (result)
                {
                    return(Logic.Enums.AvailiabilityEnum.NotAvailable);
                }

                return(Logic.Enums.AvailiabilityEnum.Available);
            }
            catch {
                return(Logic.Enums.AvailiabilityEnum.Unknown);
            }
        }