示例#1
0
 public Item VHasMaintenance(Item item, IMaintenanceService _maintenanceService)
 {
     IList<Maintenance> maintenances = _maintenanceService.GetObjectsByItemId(item.Id);
     if (maintenances.Any())
     {
         item.Errors.Add("Maintenances", "Tidak boleh terasosiasi dengan maintenance");
     }
     return item;
 }
示例#2
0
 public Item VUpdateTypeIdHasMaintenance(Item item, IItemService _itemService, IMaintenanceService _maintenanceService)
 {
     IList<Maintenance> maintenances = _maintenanceService.GetObjectsByItemId(item.Id);
     if (maintenances.Any())
     {
         Item databaseitem = _itemService.GetObjectById(item.Id);
         if (databaseitem.Id == item.Id && databaseitem.ItemTypeId != item.ItemTypeId)
         {
             item.Errors.Add("ItemTypeId", "Tidak boleh diubah jika terasosiasi dengan maintenance");
         }
     }
     return item;
 }