public Request CreateRequest(Guid driverId, string registrationNumber) { Request request = new Request() { Id = Guid.NewGuid(), }; var driver = DriverRepository.GetRouteWithVehicle(driverId); if (driver.CurrentRoute != null) { var trailer = TrailerRepository.GetByRegistrationNumber(registrationNumber); request.SetTrailer(trailer); request.SetVehicle(driver.CurrentRoute.Vehicle); request.SetStatus(RequestStatus.Active); request.SetSender(driver.Id); RequestRepository.Add(request); PersistenceContext.SaveChanges(); } return(request); }
public Trailer GetByRegistrationNumber(string trailerNumber) { return(trailersRepository.GetByRegistrationNumber(trailerNumber)); }