Esempio n. 1
0
        public ActionResult Register(UserModal um)
        {
            var mongoClient = new MongoClient("Server=localhost:27017");
            var mongoServer = mongoClient.GetServer();
            var db          = mongoServer.GetDatabase("hntsprt");
            MongoCollection <BsonDocument> userDetails    = db.GetCollection <BsonDocument>("users");
            MongoCollection <BsonDocument> ProfileDetails = db.GetCollection <BsonDocument>("profiledets");
            MongoCollection <BsonDocument> memdets        = db.GetCollection <BsonDocument>("memdets");
            profileModal pr = new profileModal();
            memModal     tm = new memModal();

            pr.userName = um.userName;
            pr.email    = um.email;
            tm.userName = um.userName;
            tm.email    = um.email;
            userDetails.Insert(um);
            ProfileDetails.Insert(pr);
            memdets.Insert(tm);
            return(View());
        }
Esempio n. 2
0
        public ActionResult publicprofile()
        {
            var          mongoClient = new MongoClient("Server=localhost:27017");
            var          mongoServer = mongoClient.GetServer();
            var          db          = mongoServer.GetDatabase("hntsprt");
            var          collection2 = db.GetCollection <BsonDocument>("profiledets");
            String       name        = Session["user"].ToString();
            var          query1      = new QueryDocument("userName", name);
            BsonDocument prod        = collection2.FindOne(query1);
            profileModal pr          = new profileModal();

            pr.userName       = prod.GetElement("userName").Value.ToString();
            pr.email          = prod.GetElement("email").Value.ToString();
            pr.full_name      = prod.GetElement("full_name").Value.ToString();
            pr.country        = prod.GetElement("country").Value.ToString();
            pr.address        = prod.GetElement("address").Value.ToString();
            pr.mobile_number  = prod.GetElement("mobile_number").Value.ToString();
            pr.p_social_link  = prod.GetElement("p_social_link").Value.ToString();
            pr.p_website_link = prod.GetElement("p_website_link").Value.ToString();
            pr.aboutYou       = prod.GetElement("aboutYou").Value.ToString();
            return(View(pr));
        }