public void editBook(int id) { book = booksRepository.Find(id); //TODO. - inverter: //book.Category = txtCategory.Text; //book.Title = txtTitle.Text; //book.Price = Convert.ToDecimal(txtPrice.Text); }
public static void UpdateBook() { HeaderMenu.Show(); Console.WriteLine("You are at: > Books > Update book."); Console.WriteLine(""); Console.Write("Type the ID of the book you want to update:"); int id = Convert.ToInt32(Console.ReadLine()); Book book = BooksRepository.Find(id); if (book != null) { Console.WriteLine($"You have selected: {book.Title}"); Console.WriteLine(""); Console.Write("Type the new title of the book you want to update:"); book.Title = Console.ReadLine(); Console.WriteLine(""); Console.Write("Type the new price of the book you want to update:"); book.Price = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine(""); BooksRepository.Update(book); Console.WriteLine(""); Console.WriteLine("Book updated successfully!"); Console.WriteLine(""); Console.WriteLine("Press any key to return."); Console.ReadKey(); } else { Console.WriteLine("Error. Invalid ID."); Console.WriteLine("Press any key to return."); Console.ReadKey(); return; } }
public void Find_Null_Test() { Book book = _repository.Find(100); Assert.IsNull(book); }