public static PurchaseViewModel ConvertToPurchaseViewModel(Purchase purchase) { PurchaseViewModel purchaseViewModel = new PurchaseViewModel { Username = purchase.User.UserName, BookTitle = purchase.Book.Title, Price = purchase.Price, DateOfPurchase = purchase.DateOfPurchase, IsRecalled = purchase.IsRecalled }; return purchaseViewModel; }