Exemple #1
0
        public void SaveUser()
        {
            var testUser = new WeSolverUser { FacebookUid = "191921", Email = "*****@*****.**" };
            _dataSource.AddUser(testUser);

            Assert.That(_dataSource.GetWeSolverUser("191921") != null, "save is not working");
        }
        public void UpdateUser(WeSolverUser user)
        {
            if (user == null)
            {
                return;
            }

            _context.UpdateObject(user);
            _context.SaveChanges();
        }
Exemple #3
0
        public void DeleteUser()
        {
            var testUser = new WeSolverUser { FacebookUid = "8178172", Email = "*****@*****.**" };

            _dataSource.AddUser(testUser);

            Assert.That(_dataSource.GetWeSolverUser("8178172") != null, "save is not working");

            _dataSource.DeleteUser("8178172");

            Assert.That(_dataSource.GetWeSolverUser("8178172") == null, "delete is not working");
        }
Exemple #4
0
        public void UpdateUser()
        {
            var testUser = new WeSolverUser { FacebookUid = "8178172", Email = "*****@*****.**" };

            _dataSource.AddUser(testUser);

            testUser.Bio = "@markrendle is cool";

            _dataSource.UpdateUser(testUser);

            var result = _dataSource.GetWeSolverUser("8178172");

            Assert.That(result.Bio == "@markrendle is cool", "update didn't work");
        }
        public void AddUser(WeSolverUser user)
        {
            if (user == null)
            {
                return;
            }

            var exsistingUser = GetWeSolverUser(user.FacebookUid);

            if (exsistingUser == null)
            {
                _context.AddObject("WeSolverUser", user);
                _context.SaveChanges();
            }
        }
        public ActionResult Login()
        {
            SignedUser signedUser = null;

            if (Request["signed_request"] != null)
            {
                var signedRequest = Request["signed_request"];
                var facebookValidation = new ValidateRegistration();
                var settings = (FacebookSettings)ConfigurationManager.GetSection("facebookSettings");
                signedUser = facebookValidation.TryValidate(settings, signedRequest);
            }

            if (signedUser != null)
            {
                var user = new WeSolverUser { FacebookUid = signedUser.UserId, Email = signedUser.Email };
                var ds = new WeSolverDataSource();
                ds.AddUser(user);
                System.Diagnostics.Trace.TraceInformation("Added user {0}-{1} in table storage for user '{2}'", user.PartitionKey, user.RowKey, user.FacebookUid);
            }

            return RedirectToAction("index", "home");
        }