示例#1
0
        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);
        }
示例#2
0
 private void UpdateShelf(Shelf old_shelf, Shelf new_shelf)
 {
     if (new_shelf != old_shelf)
     {
         old_shelf?.Remove(this);
         new_shelf.Add(this);
     }
 }
示例#3
0
        public Shelf AddShelf(string name)
        {
            var shelf = new Shelf {
                Name = name
            };

            Shelves.Add(shelf);
            return(shelf);
        }