Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var dDto in despatcherDto)
- {
- if (!IsValid(dDto))
- {
- sb.AppendLine(ErrorMessage);
- continue;
- }
- if (dDto.Position.IsNullOrEmpty())
- {
- sb.AppendLine(ErrorMessage);
- continue;
- }
- var trucks = new List<Truck>();
- foreach (var tDto in dDto.Trucks)
- {
- if (!IsValid(tDto))
- {
- sb.AppendLine(ErrorMessage);
- continue;
- }
- trucks.Add(new Truck()
- {
- RegistrationNumber = tDto.RegistrationNumber,
- VinNumber = tDto.VinNumber,
- TankCapacity = tDto.TankCapacity,
- CargoCapacity = tDto.CargoCapacity,
- CategoryType = (CategoryType)tDto.CategoryType,
- MakeType = (MakeType)tDto.CategoryType
- });
- }
- Despatcher despatcher = new Despatcher()
- {
- Name = dDto.Name,
- Position = dDto.Position,
- Trucks = trucks
- };
- valiDespatchers.Add(despatcher);
- sb.AppendLine(string.Format(SuccessfullyImportedDespatcher, despatcher.Name, trucks.Count()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement