private byte[] GetInstagramCookiesByUserPrimaryKey(string primaryKey)
        {
            //User user = repository.GetAsync<User>(u => u.InstagramPK == primaryKey).Result;
            var user = new ApplicationUser();

            using (var dbContext = new FollowerAnalyzerContext())
            {
                user = dbContext.ApplicationUsers.First(u => u.InstagramPK == primaryKey);
            }

            return(user == null ? new byte[] { } : user.StateData);
        }
Esempio n. 2
0
        public async Task <ActionResult> Logout()
        {
            await _instagramAPI.LogoutAsync();

            if (System.Web.HttpContext.Current.Session["PrimaryKey"] != null)
            {
                string primaryKey = System.Web.HttpContext.Current.Session["PrimaryKey"].ToString();

                using (var dbContext = new FollowerAnalyzerContext())
                {
                    var user = dbContext.ApplicationUsers.First(u => u.InstagramPK == primaryKey);
                    user.StateData = new byte[] { };
                    await dbContext.SaveChangesAsync();
                }
            }

            Session.Abandon();

            return(RedirectToAction("Login", "Account"));
        }