public async Task <IActionResult> Get( [FromQuery] string address, [FromQuery] string unit, [FromQuery] string state, [FromQuery] string city, [FromQuery] string zipcode ) { //validate url parameters var lookups = new Lookup(HttpContext.Request.Query) .ToList(); if (RequestValidator.ValuesMissing(lookups)) { return(BadRequest( new ErrorResponse(ResponseMessages.GetResponseMessage(400), 400) )); } try { var data = await _propertyService .GetPropertyData(lookups.FirstOrDefault(), _options.BaseUri); return(Ok(data.GetSewerResponse())); } catch (System.Exception ex) { _logger.LogError(ex.Message); return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ex.Message, 500) )); } }
public async Task <IActionResult> Post([FromBody] IEnumerable <Lookup> lookups) { if (RequestValidator.ValuesMissing(lookups)) { return(BadRequest( new ErrorResponse(ResponseMessages.GetResponseMessage(400), 400) )); } try { var data = await _propertyService.GetPropertyData(lookups, _options.BaseUri); return(Ok(data.GetSewerResponse())); } catch (System.Exception ex) { _logger.LogError(ex.Message); return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ex.Message, 500) )); } }