Advertisement
Somo4k

Untitled

Aug 15th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. foreach (var dDto in despatcherDto)
  2. {
  3.  
  4. if (!IsValid(dDto))
  5. {
  6. sb.AppendLine(ErrorMessage);
  7. continue;
  8. }
  9.  
  10. if (dDto.Position.IsNullOrEmpty())
  11. {
  12. sb.AppendLine(ErrorMessage);
  13. continue;
  14. }
  15.  
  16. var trucks = new List<Truck>();
  17.  
  18.  
  19. foreach (var tDto in dDto.Trucks)
  20. {
  21. if (!IsValid(tDto))
  22. {
  23. sb.AppendLine(ErrorMessage);
  24. continue;
  25. }
  26.  
  27.  
  28. trucks.Add(new Truck()
  29. {
  30. RegistrationNumber = tDto.RegistrationNumber,
  31. VinNumber = tDto.VinNumber,
  32. TankCapacity = tDto.TankCapacity,
  33. CargoCapacity = tDto.CargoCapacity,
  34. CategoryType = (CategoryType)tDto.CategoryType,
  35. MakeType = (MakeType)tDto.CategoryType
  36. });
  37.  
  38.  
  39. }
  40.  
  41. Despatcher despatcher = new Despatcher()
  42. {
  43. Name = dDto.Name,
  44. Position = dDto.Position,
  45. Trucks = trucks
  46. };
  47.  
  48. valiDespatchers.Add(despatcher);
  49.  
  50. sb.AppendLine(string.Format(SuccessfullyImportedDespatcher, despatcher.Name, trucks.Count()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement