public void RemoveShelf(Shelf shelf) { var default_shelf = GetDefaultshelf(); var books_to_move = shelf.Books.ToList(); books_to_move.Apply(b => b.Shelf = default_shelf); Shelves.Remove(shelf); }
private void UpdateShelf(Shelf old_shelf, Shelf new_shelf) { if (new_shelf != old_shelf) { old_shelf?.Remove(this); new_shelf.Add(this); } }
public Shelf AddShelf(string name) { var shelf = new Shelf { Name = name }; Shelves.Add(shelf); return(shelf); }