예제 #1
0
 private async Task <ResponseUrl> GetLong(IndexViewModel request)
 {
     try
     {
         return(await Task.Run(async() =>
         {
             var requestUrl = new RequestUrl(request);   // forming RequestUrl Model
             var longUri = new LongUri(requestUrl);
             var responseUrl = await longUri.Get();      // decoding ShortURL
             return responseUrl;
         }));
     }
     catch (Exception)
     {
         var responseUrl = new ResponseUrl();
         return(responseUrl);
     }
 }
예제 #2
0
        public async Task <ResponseUrl> RequestData(string token, string url, bool antivirus = false)
        {
            if (!_tokensRepository.IsTokenValid(token))
            {
                return(new ResponseUrl());
            }

            try
            {
                return(await Task.Run(async() =>
                {
                    var requestUrl = new RequestUrl(url, antivirus);    // forming RequestUrl Model
                    var longUri = new LongUri(requestUrl);
                    var responseUrl = await longUri.Get();              // decoding ShortURL
                    return responseUrl;
                }));
            }
            catch (Exception)
            {
                var responseUrl = new ResponseUrl();
                return(responseUrl);
            }
        }