Esempio n. 1
0
        public void Delete(PersonIdArgs args)
        {
            var person = repository.GetById <Person>(args.PersonId);

            if (person == null)
            {
                Console.WriteLine($"The person with id:{args.PersonId} does not exist");
                return;
            }

            repository.Delete <Person>(person);
            Console.WriteLine($"The person with id:{person.Id} has been deleted");
        }
Esempio n. 2
0
        public void Add_Address(PersonIdArgs id, AddressArgs address)
        {
            var person = repository.GetById <Person>(id.PersonId);

            if (person == null)
            {
                Console.WriteLine($"The person with id:{id.PersonId} does not exist");
                return;
            }

            var newAddress = new Address {
                Street = address.Street, City = address.City, State = address.State, PostalCode = address.PostalCode, Person = person, PersonId = id.PersonId
            };

            repository.Add <Address>(newAddress);
            Console.WriteLine($"Added a new address");
        }