Beispiel #1
0
        // POST api/values
        public void Post(SamplePortfolio value)
        {
            var server     = MongoServer.Create(connectionString);
            var db         = server.GetDatabase("rt_mongo");
            var collection = db.GetCollection <SamplePortfolio>("SamplePortfolio");

            collection.Insert(value);
        }
Beispiel #2
0
        // PUT api/values/5
        public void Put(string id, SamplePortfolio value)
        {
            var server     = MongoServer.Create(connectionString);
            var db         = server.GetDatabase("rt_mongo");
            var collection = db.GetCollection <SamplePortfolio>("SamplePortfolio");
            var update     = Update.Set("StuffID", value.StuffID)
                             .Set("TVol", value.TVol)
                             .Set("TValue", value.TValue)
                             .Set("PriceC", value.PriceC)
                             .Set("OfferPrice", value.OfferPrice)
                             .Set("IRate", value.IRate);

            collection.Update(Query.EQ("StuffID", value.StuffID), update);
        }