Example #1
0
 public SearchInput ToDomain(SearchInputDTO searchInput)
 {
     return(new SearchInput()
     {
         StartStop = _stopRepository.Find(searchInput.StartStopId),
         DestinationStop = _stopRepository.Find(searchInput.DestinationStopId),
         StartTime = searchInput.StartTime,
         StartDate = searchInput.StartDate,
     });
 }
Example #2
0
 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);
 }
Example #3
0
        public StopDTO GetById(long id)
        {
            var stopDTO = Mapper.Map <Stop, StopDTO>(_stopRepository.Find(id));

            return(stopDTO);
        }