public UpdateRoteViewModel GetRouteDetalies(int id) { UpdateRoteViewModel result = new UpdateRoteViewModel(); var stopsName = _getRouteService.GetStopsNames(id); var route = _unitOfWork.RoutesRepository.GetById(id); if (stopsName.Any() && route != null) { result.RouteId = route.Id; result.StartName = stopsName.FirstOrDefault(f => f.TypeStop == TypeStopEnum.Departure)?.Name; result.StopName = stopsName.FirstOrDefault(f => f.TypeStop == TypeStopEnum.Arrival)?.Name; result.RouteNumber = route.RouteNumber; result.NumberOfSeats = route.NumberOfSeats; result.Price = route.Price; } return(result); }