public void EditCar(EditCarCommand editCarCommand)
        {
            if (editCarCommand is null)
            {
                throw new ArgumentNullException(nameof(editCarCommand), "Input was null!");
            }
            var car = Cars.FirstOrDefault(x => x.Id == editCarCommand.Id);

            if (car is null)
            {
                throw new ArgumentException(nameof(car), "No car with this id was found!");
            }
            car.Edit(editCarCommand);
        }
Beispiel #2
0
 public IActionResult EditCar([FromBody] EditCarCommand carEditByIdCommand)
 {
     try
     {
         var client = _clientAggregateFactory.Create(carEditByIdCommand.ClientId);
         client.EditCar(carEditByIdCommand);
         _clientsWriteRepository.Save(client);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }