public SearchInput ToDomain(SearchInputDTO searchInput) { return(new SearchInput() { StartStop = _stopRepository.Find(searchInput.StartStopId), DestinationStop = _stopRepository.Find(searchInput.DestinationStopId), StartTime = searchInput.StartTime, StartDate = searchInput.StartDate, }); }
public bool ValidateEdit(StopDTO stop) { Validate(stop); if (!_stopRepository.DoesStopWithIdExist(stop.Id)) { throw new ArgumentException(ValidationResources.StopDoesntExist); } if (_stopRepository.Find(stop.Id).StopType != stop.StopType && _stopRepository.IsStopConnectedToAnyLine(stop.Id)) { throw new ArgumentException(ValidationResources.StopTypeCannotBeEditedWhenItsInPreviousTypeLine); } return(true); }
public StopDTO GetById(long id) { var stopDTO = Mapper.Map <Stop, StopDTO>(_stopRepository.Find(id)); return(stopDTO); }