Example #1
0
        public IHttpActionResult CheckIfUserExist(RegisterViewModel model)
        {
            if (string.IsNullOrEmpty(model.Phone) || string.IsNullOrEmpty(model.Email))
            {
                return(BadRequest("Phone number or email id Null"));
            }
            else
            {
                bool isPhoneExists = BL_WebsiteUser.IsPhoneNumberOrUserNameExists(model.Phone);
                bool isEmailExists = BL_WebsiteUser.IsEmailExists(model.Email);

                if (isPhoneExists && isEmailExists)
                {
                    return(BadRequest("Phone number already Associated with an account." + Environment.NewLine + " Email already Associated with an account."));
                }
                else if (isPhoneExists)
                {
                    return(BadRequest("Phone number already Associated with an account."));
                }
                else if (isEmailExists)
                {
                    return(BadRequest("Email already Associated with an account."));
                }
                else
                {
                    return(Ok());
                }
            }
        }