Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
            }
        }