Beispiel #1
0
        public static void DeletePerson()
        {
            Guid personGuid  = ConsoleInputHelper.GetGuidFromConsole("Enter Guid of Person: ");
            var  mongoDB     = new MongoCRUD("AddressBook");
            var  personFound = mongoDB.LoadRecordById <PersonModel>("Users", personGuid);

            if (personFound != null)
            {
                mongoDB.DeleteRecord <PersonModel>("Users", personGuid);
            }
        }
Beispiel #2
0
        public static void UpdatePerson()
        {
            Guid     personGuid = ConsoleInputHelper.GetGuidFromConsole("Enter Guid of Person: ");
            DateTime dob        = ConsoleInputHelper.GetDateTimeFromConsole();

            var mongoDB = new MongoCRUD("AddressBook");
            var person  = mongoDB.LoadRecordById <PersonModel>("Users", personGuid);

            person.DateOfBirth = dob;
            mongoDB.UpsertRecord("Users", person.Id, person);
        }