Apachai.Apachai.FetchLinkInformations C# (CSharp) Method

FetchLinkInformations() private method

private FetchLinkInformations ( IManosContext ctx, string id ) : void
ctx IManosContext
id string
return void
        public void FetchLinkInformations(IManosContext ctx, string id)
        {
            if (string.IsNullOrEmpty (id))
                 ctx.Response.HandleEmptyJson ();

            string json;
            if (store.TryGetPictureLinks (id, out json)) {
                ctx.Response.HandleJson (json);
                return;
            }

            JsonStringDictionary dict = new JsonStringDictionary ();

            var shortUrl = baseServerUrl + "/s/" + store.GetShortUrlForImg (id);
            var longUrl = baseServerUrl + "/i/" + id;
            var ogUrl = baseServerUrl + "/og/" + id;

            dict["short"] = shortUrl;
            dict["permanent"] = longUrl;
            dict["facebook"] = ogUrl;

            json = dict.Json;
            store.SetPictureLinks (id, json);

            ctx.Response.HandleJson (json);
        }