示例#1
0
        public async Task <JsonResult> GetTinyUrl(string url)
        {
            TinyUrl        provider = new TinyUrl(url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
示例#2
0
        public async Task <JsonResult> GetTrIm(string url)
        {
            string         key      = "36b56b77ac24e5595b626b38c6e00074";
            TrIm           provider = new TrIm(key, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
示例#3
0
        public async Task <JsonResult> GetGoogl(string url)
        {
            string         key      = "AIzaSyD8UPkwOX2SZJGBFKazFZ1wFIJeVu6UWMA";
            Googl          provider = new Googl(key, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
示例#4
0
        public async Task <JsonResult> GetBitLy(string url)
        {
            string         token    = "bc6da10fdeaf9464d82cdf475cfb3b19c1a506ca";
            Bitly          provider = new Bitly(token, url);
            ShortUrlClient client   = ShortUrlClientFactory.Create(provider);

            return(Json(await client.ReceiveAsync(), JsonRequestBehavior.DenyGet));
        }
示例#5
0
        public async Task <ActionResult> Index()
        {
            string url = "http://www.globo.com";

            ShortUrlClient client = new ShortUrlClient(new IsGd(url));

            ShortUrlReceive response = await client.ReceiveAsync();

            client.Dispose();

            ViewBag.Url = response.ShortUrl;

            return(View());
        }
示例#6
0
        public async Task <ActionResult> Index()
        {
            TinyUrl turl = new TinyUrl("http://www.gmail.com");

            ShortUrlClient client = ShortUrlClientFactory.Create(turl);

            ShortUrlReceive response = await client.ReceiveAsync();

            client.Dispose();

            ViewBag.Url = response.ShortUrl;

            return(View());
        }