public string ReportView() { Book book = Item as Book; if (book == null) { Magazine magazine = Item as Magazine; return($"magazine name: {magazine.Name} genre: {Enum.GetName(typeof(Genres), (int)magazine.Genre)}" + $" edition: {magazine.Edition} publisher: {magazine.Publisher} price: {magazine.Price} happend: {WhenBorrowHappend} end: {WhenBorrowEnds}"); } else { return($"magazine name: {book.Name} genre: {Enum.GetName(typeof(Genres), (int)book.Genre)}" + $" auther: {book.Auther} publisher: {book.Publisher} price: {book.Price} happend: {WhenBorrowHappend} end: {WhenBorrowEnds}"); } }
public override string ToString() { Book book = Item as Book; if (book == null) { Magazine magazine = Item as Magazine; return($"you borrowd the {Enum.GetName(typeof(Genres), (int)magazine.Genre)} magazine {magazine.Name} edition {magazine.Edition} " + $"Published by {magazine.Publisher} at the price of {magazine.Price} in {WhenBorrowHappend.ToShortDateString()}"); } else { return($"you borrowd the {Enum.GetName(typeof(Genres), (int)book.Genre)} book {book.Name} written by {book.Auther} " + $"Published by {book.Publisher} at the price of {book.Price} in {WhenBorrowHappend.ToShortDateString()}"); } }