/// <summary> /// This method deletes document from the collection. It will also remove the document from the cache /// </summary> /// <param name="product"> Product whos ID will be used to remove document from the collection /// and cache </param> private void DeleteDocument(Product product) { // Delete from the Products collection. This call will also remove documents from cache. _productsCollection.DeleteDocument(product.ID, WriteConcern.InMemory); Console.WriteLine("Product deleted from the database. "); }
/// <summary> /// This method deletes the attachment from the attachment store for the given employee /// </summary> /// <param name="employee"> Employee whos employeeId will be used to remove attachment from the /// attachment store</param> public void DeleteAttachment(Employee employee) { // Delete the employee added _employeeCollection.DeleteDocument(employee.EmployeeID, WriteConcern.InMemory); // Generate attachmentId to be deleted string attachmentId = GenerateAttachmentId(employee.EmployeeID); // Delete attachment from the database _attachmentStore.DeleteAttachment(attachmentId); Console.WriteLine("Attachment deleted from the database."); }
/// <summary> /// This method deletes product form the collection /// </summary> /// <param name="cheeseProduct"> Product whos ID will be used to delete data from the collection </param> private void DeleteDocument(Product cheeseProduct) { // Delete the document that was inserted. _productsCollection.DeleteDocument(cheeseProduct.ID); }