public async Task <ActionResult <UrlAssociationData> > GetUrlAsync(string key) { if (string.IsNullOrWhiteSpace(key)) { return(BadRequest("Valid key is required")); } var urlData = await _urlService.GetByKeyAsync(key); if (urlData == null) { return(BadRequest($"Url not found for {key}")); } return(Redirect(urlData.Address)); }