Exemplo n.º 1
0
        /// <summary>
        /// Home Page
        /// </summary>
        /// <returns>Action Result</returns>
        public ActionResult Index(string ReturnUrl = null)
        {
            if (base.User.Identity.IsAuthenticated)
            {
                var cookie = Request.Cookies[returnCookieName];
                if (null == cookie || string.IsNullOrWhiteSpace(cookie.Value))
                {
                    return(this.RedirectToAction("Index", "Dashboard"));
                }
                else
                {
                    cookie.Expires = DateTime.Now.AddDays(-1);
                    Response.Cookies.Set(cookie);

                    return(Redirect(cookie.Value));
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(ReturnUrl))
                {
                    var cookie = new HttpCookie(returnCookieName, ReturnUrl)
                    {
                        Expires = DateTime.Now.AddHours(1),
                    };

                    Response.Cookies.Add(cookie);
                }
                var theme = Request.QueryString["theme"];
                if (!string.IsNullOrWhiteSpace(theme))
                {
                    var cookie = new HttpCookie(ThemeCookieName, theme)
                    {
                        Expires = DateTime.Now.AddDays(31),
                    };

                    Response.Cookies.Add(cookie);
                }

                var emptyHomePage = new HomePage()
                {
                    Share = new ItemShare(),
                };

                try
                {
                    if (null == homePage)
                    {
                        var blob = new JsonContainer();
                        homePage = blob.Get <HomePage>("landingpage");
                    }
                }
                catch
                {
                }

                return(View(homePage ?? emptyHomePage));
            }
        }
Exemplo n.º 2
0
        public void RoundTrip()
        {
            var data = new SearchLocationIp()
            {
                Location = Guid.NewGuid().ToString(),
            };

            var objId     = "a" + Guid.NewGuid().ToString();
            var container = new JsonContainer("jsontests");

            container.Create().Wait();

            container.Save(objId, data).Wait();

            var result = container.Get <SearchLocationIp>(objId);

            Assert.IsNotNull(result);
            Assert.AreEqual <string>(data.Location, result.Location);
        }
        public void SaveGet()
        {
            var random    = new Random();
            var container = new JsonContainer <Entity>(CloudStorageAccount.DevelopmentStorageAccount);

            container.EnsureExist();
            var entity = new Entity()
            {
                PartitionKey = Guid.NewGuid().ToBase64(),
                RowKey       = Guid.NewGuid().ToAscii85(),
                ToTest       = random.Next()
            };
            var id = Guid.NewGuid().ToString();

            container.Save(id, entity);

            var returned = container.Get(id);

            Assert.IsNotNull(returned);
            Assert.AreEqual <string>(entity.PartitionKey, returned.PartitionKey);
            Assert.AreEqual <string>(entity.RowKey, returned.RowKey);
            Assert.AreEqual <int>(entity.ToTest, returned.ToTest);
        }
Exemplo n.º 4
0
        public void GetInvalidId()
        {
            var container = new JsonContainer <Entity>(CloudStorageAccount.DevelopmentStorageAccount);

            container.Get(StringHelper.NullEmptyWhiteSpace());
        }
Exemplo n.º 5
0
        public IEnumerable <CountryPercentage> MembersByCountry()
        {
            var blob = new JsonContainer();

            return(blob.Get <IEnumerable <CountryPercentage> >("globalheatmap"));
        }