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); }
public bool AddNewPerson(Person person) { database.users.Add(DBToLibrary.LibraryToUser(person)); database.SaveChanges(); return(true); }