Exemple #1
0
        private string GetErrorIfInvalid(User user, bool shouldCheckUsername)
        {
            var error = string.Empty;

            if (string.IsNullOrWhiteSpace(user.UserName))
            {
                error = "user name cant be empty or null";
            }
            if (shouldCheckUsername && _userBl.IsUserExist(user.UserName))
            {
                error = "user name already exist";
            }

            if (user.Gender.ToString().Length < 1)
            {
                error = "Please Select Gender";
            }

            return(error);
        }