public void Create(string content)
 {
     ViewBag.Username = HttpContext.Session.GetString("username");
     _context.posts.Add(new Post {
         content = content, username = ViewBag.username
     });
     _context.SaveChanges();
     Response.Redirect("Index");
 }
        public void Create(string username, string password)
        {
            var user = _context.users.SingleOrDefault(c => c.username == username);

            if (user != null)
            {
                TempData["FlashMessage"] = "Username already in use";
                Response.Redirect("New");
            }
            else
            {
                var encrypted = Acebook.Models.Encryption.EncryptPassword(password);
                _context.users.Add(new User {
                    username = username, password = encrypted
                });
                _context.SaveChanges();
                HttpContext.Session.SetString("username", username);
                Response.Redirect("../Post");
            }
        }