public Customer VName(Customer customer, ICustomerService _customerService) { if (String.IsNullOrEmpty(customer.Name) || customer.Name.Trim() == "") { customer.Errors.Add("Name", "Tidak boleh kosong"); } if (_customerService.IsNameDuplicated(customer)) { customer.Errors.Add("Name", "Tidak boleh ada duplikasi"); } return customer; }
public Item VHasUniqueCustomer(Item item, ICustomerService _customerService) { Customer customer = _customerService.GetObjectById(item.CustomerId); if (customer == null) { item.Errors.Add("Customer", "Tidak boleh tidak ada"); } if (_customerService.IsNameDuplicated(customer)) { item.Errors.Add("Customer", "Tidak boleh diduplikasi"); } return item; }