Пример #1
0
        public void DeleteOrder()
        {
            MongodbFunctions mongo = new MongodbFunctions();

            Database.DomainModel.User  user  = mongo.GetUser(User.Identity.Name);
            Database.DomainModel.Order order = mongo.GetOpenOrder(user.Id);

            mongo.DeleteOrder(order.Id);
        }
Пример #2
0
        public void DeleteFromChart(string id)
        {
            MongodbFunctions mongo = new MongodbFunctions();

            Database.DomainModel.User  user  = mongo.GetUser(User.Identity.Name);
            Database.DomainModel.Order order = mongo.GetOpenOrder(user.Id);

            order.Products.Remove(new MongoDBRef("products", new ObjectId(id)));

            if (order.Products.Count > 0)
            {
                mongo.RemoveProduct(order);
            }
            else
            {
                mongo.DeleteOrder(order.Id);
            }
        }