Skip to content

Instantly share code, notes, and snippets.

@AbhinavPradeep
Created December 20, 2019 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhinavPradeep/a379675060ec3effba8c2adc964a64b1 to your computer and use it in GitHub Desktop.
Save AbhinavPradeep/a379675060ec3effba8c2adc964a64b1 to your computer and use it in GitHub Desktop.
Adding a person as a customer in a mongodb database
private static void AddCustomer(IMongoCollection<Person> collection)
{
bool repeat = true;
PersonFactory factory = new PersonFactory();
Person person = new Person();
while (repeat)
{
person = factory.CreatePerson();
collection.InsertOne(person);
Console.WriteLine("Go again? Y/N: ");
string go = Console.ReadLine();
if (go.ToUpper() != "Y")
repeat = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment