public TestDTO GetProduct(string id) { var filter = Builders <Product> .Filter.Eq("_id", id); var result = _db.Products.Find(filter).FirstOrDefault(); return(TestDTO.Data(result)); }
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)); }