Skip to content

Instantly share code, notes, and snippets.

@AbhinavPradeep
Created December 20, 2019 02:36
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/5f7bee9566d0d1a51bc3e8420c7b9b5a to your computer and use it in GitHub Desktop.
Save AbhinavPradeep/5f7bee9566d0d1a51bc3e8420c7b9b5a to your computer and use it in GitHub Desktop.
using System;
namespace MongoAddress
{
class PersonFactory
{
public Person CreatePerson()
{
Person person = new Person();
System.Console.WriteLine("Enter The _id of the document");
string personidstr = System.Console.ReadLine();
Int32.TryParse( personidstr, out int personid);
person._id = personid;
System.Console.WriteLine("Enter the customers first name");
person.FirstName = System.Console.ReadLine();
System.Console.WriteLine("Enter the customers last name");
person.LastName = System.Console.ReadLine();
Address address = new Address();
System.Console.WriteLine("Enter the customers country");
address.Country = System.Console.ReadLine();
System.Console.WriteLine("Enter the customers state");
address.State = System.Console.ReadLine();
System.Console.WriteLine("Enter the customers area");
address.Area = System.Console.ReadLine();
System.Console.WriteLine("Enter the customers street");
address.Street = System.Console.ReadLine();
System.Console.WriteLine("Enter the customes house number");
Int32.TryParse( System.Console.ReadLine(), out int inthouse);
address.HouseNum = inthouse;
person.Address = address;
return person;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment