public async Task <DailyRouteDto> Handle(GetDailyRouteQuery request, CancellationToken cancellationToken) { var dailyRoute = await _routeRepository.GetAsync(request.Id); if (dailyRoute is null) { throw new ArgumentNullException($"Route with {request.Id} not exist"); } return(_mapper.Map <Core.Domain.DailyRoute, DailyRouteDto>(dailyRoute)); }
public static async Task <DailyRoute> GetOrFailAsync(this IDailyRouteRepository dailyRouteRepository, Guid id) { var dailyRoute = await dailyRouteRepository.GetAsync(id); if (dailyRoute == null) { throw new ArgumentNullException($"DailyRoute with {id} not exist"); } return(dailyRoute); }