예제 #1
0
        public TestDTO GetProduct(string id)
        {
            var filter = Builders <Product> .Filter.Eq("_id", id);

            var result = _db.Products.Find(filter).FirstOrDefault();

            return(TestDTO.Data(result));
        }
예제 #2
0
 public TestDTO AddProduct(Product item)
 {
     _db.Products.InsertOne(item);
     return(TestDTO.Data(item));
 }
        public TestDTO GetAllProducts()
        {
            var result = _db.Products.AsQueryable <Product>();

            return(TestDTO.Data(result));
        }