public IActionResult RedirectToResolvedURL(String unresolved_url) { // redirect user to resolved URL ResolvedURL resolvedURL = LinkGenerator.ResolveURL(unresolved_url); return(Redirect(resolvedURL.resolved_url)); }
public static ResolvedURL AddURL(String url) { ResolvedURL resolvedUrl = GenerateRandomURL(url); _fakedb.Add(resolvedUrl); return(resolvedUrl); }
public ActionResult <ResolvedURL> Submit() { using (var streamReader = new HttpRequestStreamReader(Request.Body, System.Text.Encoding.UTF8)) { // deserialize JSON URLContainer urlObj = JsonConvert.DeserializeObject <URLContainer>(streamReader.ReadToEnd()); ResolvedURL randomUrl = LinkGenerator.AddURL(urlObj.url); return(randomUrl); } }