예제 #1
0
        public ActionResult Author(string encrypted)
        {
            encrypted = Helpers.XOR.Decrypt(encrypted, Helpers.Constants.XORAppKey);
            string scriptURL = HttpUtility.UrlDecode(encrypted);
            CardAuthorModel model = new CardAuthorModel();

            try
            {
                using (var client = new WebClient())
                {
                    string json = @client.DownloadString(scriptURL);
                    JObject cardInfo = JObject.Parse(json);
                    string cardType = cardInfo["type"].ToString();
                    if (cardType.ToLower() == "author")
                    {
                        model = cardInfo["parameters"].ToObject<CardAuthorModel>();
                        return PartialView(model);
                    }
                    else
                    {
                        return RedirectToAction("Error");
                    }
                }
            }
            catch
            {
                return RedirectToAction("Error");
            }
        }
예제 #2
0
        public ActionResult Author(CardAuthorModel model)
        {
            if (String.IsNullOrEmpty(model.ImageURL))
            {
                model.ImageURL = Url.Content("~/Content/images/defaultimage.png");
            }

            if (String.IsNullOrEmpty(model.ProfileImageURL))
            {
                model.ProfileImageURL = Url.Content("~/Content/images/defaultprofileimage.png");
            }

            model.Name = HttpUtility.HtmlDecode(model.Name);
            model.Location = HttpUtility.HtmlDecode(model.Location);
            model.Description = HttpUtility.HtmlDecode(model.Description);
            model.LeftFooter = HttpUtility.HtmlDecode(model.LeftFooter);
            model.RightFooter = HttpUtility.HtmlDecode(model.RightFooter);

            return PartialView(model);
        }