public void DeleteDocumentValid() { var store = new DocumentStore { ConnectionStringName = AppSettings.DataBaseName }; store.Initialize(); var repo = new ValidationRepository(store); var customer = new Customer { City = "Almaville", EMail = "*****@*****.**", Name = "Customer, Anna", Number = "34", Street = "Lohengrin", }; customer.Orders.Add(new Order { Amount = 23, Name = "Order 1" }); customer.Orders.Add(new Order { Amount = 245, Name = "Order 2" }); customer.Orders.Add(new Order { Amount = 5, Name = "Order 3" }); customer.Orders.Add(new Order { Amount = 5476, Name = "Order 4" }); repo.SaveDocument(customer); repo.DeleteDocument<Customer>(customer.Id); }
public void Save() { // FluentValidation var isValid = ValidateModel<CustomerValidator, Customer>(Customer); if (isValid) { validationRepository.SaveDocument(Customer); Customer = new Customer(); } // DataAnnotations //var entityValidator = new EntityValidator<Customer>(); //var entityValidationResult = entityValidator.Validate(Customer); //Errors.Clear(); //Errors.AddRange(entityValidationResult.Errors.Select(e => e.ErrorMessage)); //if (Errors.Count == 0) //{ // validationRepository.SaveDocument(Customer); // Customer = new Customer(); //} }