public async Task <TruckRegisteredResponse> Handle(RegisterTruckCommand request, CancellationToken cancellationToken) { var truck = new Truck( request.Km, request.LicensePlate, request.Brand, request.Model, _truckUniquenessChecker); _vehicleService.SaveTruck(truck); return(_truckRegisteredResponse.Create(truck)); }
public async Task <ActionResult <CyclingConditions> > GetCyclingWeatherStatus(string city) { bool isCyclable = false; IWeatherData weather; if (city == null) { return(BadRequest()); } try { weather = await _weatherApi.getData(city); isCyclable = _activityPossibility.Validate(weather); } catch (Exception ex) { Debug.WriteLine("Exception: " + ex.Message); return(StatusCode(500, "Internal server Error")); } return(_cyclingConditionsResponse.Create(isCyclable, weather)); }