public Consignment GetConsignment(int consignmentId) { var result = _consignmentsRepository.GetConsignment(consignmentId); var consignment = result.Consignment; consignment.Packages = result.Packages; BindItemsToPackages(result, consignment); OrderConsignmentPackages(consignment); return(consignment); }
public AssemblyMms CreateAssemblyMms(AssemblyMms assemblyMms) { if ((assemblyMms.AccelerometerId != null && assemblyMms.GyroscopeId != null) || (assemblyMms.AccelerometerId is null && assemblyMms.GyroscopeId is null)) { throw new ArgumentException($"Please, enter ID Accelerometer or Gyroscope "); } if (assemblyMms.AccelerometerId != null) { var accelerometer = _accelerometerRepository .GetAccelerometer(assemblyMms.AccelerometerId); if (accelerometer.AssemblyMms != null) { throw new ArgumentException($"У введенного вами акселерометра другой ММД "); } assemblyMms.Accelerometer = accelerometer; } if (assemblyMms.GyroscopeId != null) { var gyroscope = _gyroscopeRepository .GetGyroscope(assemblyMms.GyroscopeId); if (gyroscope.AssemblyMms != null) { throw new ArgumentException($"У введенного вами гироскопа другой ММД "); } assemblyMms.Gyroscope = gyroscope; } if (assemblyMms.AuthorId != null) { assemblyMms.Author = _authorRepository.GetAuthor(assemblyMms.AuthorId.Value); } if (assemblyMms.ConsignmentId != null) { assemblyMms.Consignment = _consignmentRepository .GetConsignment(assemblyMms.ConsignmentId); } return(_assemblyMmsRepository.CreateAssemblyMms(assemblyMms)); }
public Consignment GetConsignment(string id) { return(_consignmentRepository.GetConsignment(id)); }