コード例 #1
0
 public Manufacturer CreateManufacturer(Manufacturer manufacturer)
 {
     if (manufacturer.ManufacturerId < 0)
     {
         throw new ArgumentException("Manufacturer ID for new car can not be negative");
     }
     if (_manuRepository.ReadManufacturerById(manufacturer.ManufacturerId) != null)
     {
         throw new InvalidOperationException("Manufacturer ID can not match car which already exists");
     }
     if (_validator != null)
     {
         _validator.ValidateManufacturer(manufacturer);
     }
     return(_manuRepository.AddManufacturer(manufacturer));
 }