Пример #1
0
 public Maintenance VHasCustomer(Maintenance maintenance, ICustomerService _customerService)
 {
     Customer customer = _customerService.GetObjectById(maintenance.CustomerId);
     if (customer == null)
     {
         maintenance.Errors.Add("Customer", "Tidak boleh tidak ada");
     }
     return maintenance;
 }
Пример #2
0
 public Maintenance VHasItem(Maintenance maintenance, IItemService _itemService, ICustomerService _customerService)
 {
     Item item = _itemService.GetObjectById(maintenance.ItemId);
     if (item == null)
     {
         maintenance.Errors.Add("Item", "Tidak boleh tidak ada");
     }
     Customer customer = _customerService.GetObjectById(item.CustomerId);
     if (customer == null)
     {
         maintenance.Errors.Add("Customer", "Tidak boleh tidak ada");
     }
     if (customer.Id != maintenance.CustomerId)
     {
         maintenance.Errors.Add("CustomerId", "Tidak boleh berbeda dengan customerId dari item");
     }
     return maintenance;
 }
Пример #3
0
 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;
 }