// DELETE api/Employees/5 public void Delete(Employee emp) { var client = new MongoClient(Settings.Default.MongoConnection); var db = client.GetDatabase(Settings.Default.DBName); var collection = db.GetCollection<Employee>("Employees"); collection.DeleteOneAsync(p=>p.name.Equals(emp.name)); }
// POST api/Employees public async void Post(Employee emp) { var client = new MongoClient(Settings.Default.MongoConnection); var db = client.GetDatabase(Settings.Default.DBName); var collection = db.GetCollection<Employee>("Employees"); collection.InsertOneAsync(emp); }