예제 #1
0
        public bool EditPerson(int oldPersonId, Person newPerson)
        {
            var personToEdit = database.users.Where((person) => person.Id == oldPersonId).First();

            if (personToEdit == null)
            {
                return(false);
            }

            database.Entry(personToEdit).CurrentValues.SetValues(DBToLibrary.LibraryToUser(newPerson));
            database.SaveChanges();
            return(true);
        }
예제 #2
0
 public bool AddNewPerson(Person person)
 {
     database.users.Add(DBToLibrary.LibraryToUser(person));
     database.SaveChanges();
     return(true);
 }