public void UpdateUser(VaultUser user)
        {
            //throw new NotImplementedException();
            MongoServer mongo = MongoServer.Create();

            mongo.Connect();
            var db         = mongo.GetDatabase("MessageVault");
            var collection = db.GetCollection <MongoMail>("VaultUsers");

            collection.Save(user);
        }
        public VaultUser GetUserByEmail(string emailaddr)
        {
            //throw new NotImplementedException();
            MongoServer mongo = MongoServer.Create();

            mongo.Connect();
            var db         = mongo.GetDatabase("MessageVault");
            var collection = db.GetCollection <VaultUser>("VaultUsers");
            var MyQuery    = Query <VaultUser> .EQ(g => g.emailAddress, emailaddr);

            VaultUser usr = collection.FindOneAs <VaultUser>(MyQuery);

            return(usr);
        }
        public void CreateUser(VaultUser user)
        {
            MongoServer mongo = MongoServer.Create();

            mongo.Connect();
            var db         = mongo.GetDatabase("MessageVault");
            var collection = db.GetCollection <VaultUser>("VaultUsers");
            var MyQuery    = Query <VaultUser> .EQ(g => g.emailAddress, user.emailAddress);

            long counter = collection.FindAs <VaultUser>(MyQuery).Count();

            if (counter == 0)
            {
                collection.Insert(user);
            }
        }