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

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