Created
December 20, 2019 03:13
-
-
Save AbhinavPradeep/a379675060ec3effba8c2adc964a64b1 to your computer and use it in GitHub Desktop.
Adding a person as a customer in a mongodb database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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