internal IValidationResult Customer(Customer customer) { IValidationResult validationResult = new ValidationResult(); // Is the customer id valid? if (customer.CustomerId <= 0 || customer.CustomerId > int.MaxValue) { validationResult.AddError("CustomerId.Range", "CustomerId can not be less than or equal to 0. Also, the upper limit cannot exceed the max value of the long data type."); } // Is the customer name valid? if (customer.Name == string.Empty || customer.Name == null) { validationResult.AddError("CustomerName.Null", "CustomerName can not be empty or null."); } // Does the customer already exist in the database? if (this.doctrineShipsRepository.GetCustomer(customer.CustomerId) != null) { validationResult.AddError("CustomerId.Exists", "CustomerId already exists in the database."); } return validationResult; }
public void UpdateCustomer(Customer customer) { CustomerOperations.UpdateCustomer(customer); }
public Customer CreateCustomer(Customer customer) { return CustomerOperations.CreateCustomer(customer); }
public Customer AddCustomer(Customer customer) { return CustomerOperations.AddCustomer(customer); }
internal void UpdateCustomer(Customer customer) { customer.ObjectState = ObjectState.Modified; this.unitOfWork.Repository<Customer>().Update(customer); }
internal Customer CreateCustomer(Customer customer) { customer.ObjectState = ObjectState.Added; this.unitOfWork.Repository<Customer>().Insert(customer); return customer; }
internal Customer AddCustomer(Customer customer) { this.unitOfWork.Repository<Customer>().Insert(customer); return customer; }
public IValidationResult Customer(Customer customer) { return CustomerCheck.Customer(customer); }