public IActionResult RedirectToResolvedURL(String unresolved_url)
        {
            // redirect user to resolved URL
            ResolvedURL resolvedURL = LinkGenerator.ResolveURL(unresolved_url);

            return(Redirect(resolvedURL.resolved_url));
        }
Esempio n. 2
0
        public static ResolvedURL AddURL(String url)
        {
            ResolvedURL resolvedUrl = GenerateRandomURL(url);

            _fakedb.Add(resolvedUrl);

            return(resolvedUrl);
        }
Esempio n. 3
0
        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);
            }
        }