static void Main(string[] args) { ShortUrlRepository das = new ShortUrlRepository(); string str = Console.ReadLine(); Console.WriteLine(das.lengthenUrl(str)); }
public JsonResult <string> LengthenUrl(string url) { try { ShortUrlRepository dal = new ShortUrlRepository(); var fullUrl = dal.lengthenUrl(url); return(Json <string>(fullUrl)); } catch (Exception ex) { var response = new HttpResponseMessage(HttpStatusCode.GatewayTimeout) { Content = new StringContent("Unable to connect to database", System.Text.Encoding.UTF8, "text/plain"), StatusCode = HttpStatusCode.GatewayTimeout }; throw new HttpResponseException(response); } }