Esempio n. 1
0
        public PeopleViewModel(Person person) {
            InitializeDependencies();
            List<Person> peopleList = GetPeopleFromDB();

            SetPeopleList(peopleList);
            currentPerson = new PersonViewModel(person);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            using (var context = new SimpleContext ()) {
                var person = new Person {
                    FirstName = "Hudson",
                    LastName = "Hawk"
                };

                context.People.Add (person);
                context.SaveChanges ();

            //                bool saveFailed;
            //                do
            //                {
            //                    saveFailed = false;
            //
            //                    try
            //                    {
            //                        context.SaveChanges();
            //                    }
            //                    catch (DbUpdateConcurrencyException ex)
            //                    {
            //                        saveFailed = true;
            //
            //                        // Update the values of the entity that failed to save from the store
            //                        foreach (var e in ex.Entries) {
            //                            e.Reload();
            //                        }
            //                    }
            //
            //                } while (saveFailed);
            }
        }
Esempio n. 3
0
 public PersonViewModel(Person p) {
     if (p != null) {
         person = p;
     }
     else {
         person = new Person();
     }
 }
Esempio n. 4
0
 public PersonViewModel(int id) {
     person = Person.GetPerson(id);
 }