public void StartTransport(List <Guid> batchesId, UserDTO user) { bool existBatches = ExistBatches(batchesId); if (existBatches) { bool batchesAreReady = BatchesAreReady(batchesId); if (batchesAreReady) { List <BatchDTO> listBatches = new List <BatchDTO>(); foreach (Guid id in batchesId) { BatchDTO batch = batchService.FindBatchById(id); foreach (string vin in batch.Vehicles) { VehicleDTO vehicleDTO = vehicleService.FindVehicleByVin(vin); vehicleDTO.Status = StatusCode.InTransit; vehicleService.UpdateVehicle(vehicleDTO); } listBatches.Add(batch); } TransportDTO transport = new TransportDTO(); transport.Batches = listBatches; transport.StartDate = DateTime.Now; transport.User = user; this.CreateTransport(transport); } else { throw new BatchIsNotReadyException("Hay vehículos en el lote que aún no se pueden transportar"); } } else { throw new BatchNotFoundException("Un lote ingresado no está registrado en el sistema"); } }