public HttpResponseMessage Post([FromBody] String url) { using (UrlManager urlManager = new UrlManager()) { return Request.CreateResponse(HttpStatusCode.OK, urlManager.AddShortUrl(url)); } }
public HttpResponseMessage Get(string key) { using (UrlManager urlManager = new UrlManager()) { var response = Request.CreateResponse(HttpStatusCode.Moved); String urlString = urlManager.GetUrl(key); if (!String.IsNullOrWhiteSpace(urlString)) { response.Headers.Location = new Uri(urlString); return response; } } return null; }