Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            FacebookGraph fbUser;

            if (StateManager.IsAuthenticated(out fbUser))
            {
                var user = new UsersService().GetUserByExternalId(fbUser.Id);
                if (user != null)
                {
                    var code = Guid.NewGuid().ToString();
                    var site = new Sites()
                    {
                        flickr_username   = txtFlickrUsername.Text,
                        title             = txtTitle.Text,
                        site_type         = Convert.ToInt32(txtType.Text),
                        verification_code = code
                    };
                    new SitesService().Save(user.id, txtEmail.Text, site);

                    this.pnlForm.Visible = false;
                    this.pnlMsg.Visible  = true;
                    this.lblMsg.Text     = "El sitio se ha creado satisfactoriamente, accedé ya al mismo:";

                    var shortUrl = GoogleConsumer.ShortenUrl(PageFlowExtensions.GetDefaultPageUrl().OriginalString + "?icode=" + code);

                    this.hlLink.NavigateUrl = shortUrl;
                    this.hlLink.Text        = shortUrl;
                }
            }
        }
Example #2
0
        public string GenerateSiteShortLink(string verification_code)
        {
            var action = Url.Action("Index", "Home", new RouteValueDictionary {
                { "icode", verification_code }
            });

            if (action.StartsWith(@"/"))
            {
                action = action.Substring(1);
            }

            var url      = Url.GetBaseUrl() + action;
            var shortUrl = GoogleConsumer.ShortenUrl(url);

            return(shortUrl);
        }