Exemplo n.º 1
0
        public ValidationResult Delete(object id)
        {
            AppUserValidator validator = new AppUserValidator();
            var entity = repo.FindById(id);
            ValidationResult result = validator.Validate(entity);

            if (result.IsValid)
            {
                repo.Delete(id);
                repo.Save();
            }
            return(result);
        }
Exemplo n.º 2
0
        public ValidationResult Update(ApplicationUser entity)
        {
            AppUserValidator validator = new AppUserValidator();
            ValidationResult result    = validator.Validate(entity);

            if (result.IsValid)
            {
                entity.IsActive    = true;
                entity.IsDeleted   = false;
                entity.CreatedDate = DateTime.Now;
                repo.Update(entity);
                repo.Save();
            }

            return(result);
        }