Ejemplo n.º 1
0
        public async Task RegistrationUserAsync(Repository.Layer.Repository repository, IUser user, ValidationSystem validationSystem)
        {
            var userPartsNulOrEmpty = repository.IsUserInformationValidate(user);

            validationSystem.SetUser(user);
            try
            {
                var userValidParametersDeep = await validationSystem.GetAllValidationForUserAsync();

                var succsessValidation = userValidParametersDeep
                                         .Count(o => o.IsValidate == true);

                if (userPartsNulOrEmpty && succsessValidation == 4)
                {
                    repository.RegistreUser(user);
                }

                validationSystem._user = null;
            }
            catch (Exception ex)
            {
                var exeption = ex.Message;
            }
        }
Ejemplo n.º 2
0
        public async Task <IUser> LoginUserInSystemAsync(string password, string mail, Repository.Layer.Repository repository)
        {
            var isParamsNulOrEmpty = !repository.IsStringsNullOrEmpty(password, mail);

            if (isParamsNulOrEmpty)
            {
                try
                {
                    var currentUser = await repository.LoginUserAsync(mail, password);

                    return(currentUser);
                }
                catch (Exception ex)
                {
                    var mess = ex.Message;
                }
            }

            return(null);
        }
        public void EditInformationService(int userId, Dictionary <string, string> editValuePears, Repository.Layer.Repository repository)
        {
            if (userId <= 0 && editValuePears == null && repository == null)
            {
                throw new ArgumentNullException("User id or editValue pears and repository is null or empty");
            }

            repository.EditUserInformation(userId, editValuePears);
        }