예제 #1
0
        private ModelStateDictionary ValidateUser(User user)
        {
            var errors = new ModelStateDictionary();

            if (user == null)
            {
                errors.AddModelErrorSafety(string.Empty, Resource.IncorrectLogin);
            }
            else if (user.Status.Id != EnumHelper.GetStatusIdByEnum(UserStatus.Active))
            {
                errors.AddModelErrorSafety(string.Empty, Resource.RegistrationNotCompleteOrBlocked);
            }
            else if (user.RoleActivities.IsNullOrEmpty())
            {
                errors.AddModelErrorSafety(string.Empty, Resource.ForbiddenError);
            }

            return(errors);
        }