@namespace MidrandBooks.Components @using Microsoft.AspNetCore.Components @using MidrandBooks.Models
@if (!string.IsNullOrEmpty(Book.CoverUrl)) { @Book.Title } else {
@Book.Category @Book.Title By @Book.Author
}
PUBLISHED @Book.PublishedYear
PAGES @(Book.PagesCount?.ToString() ?? "N/A")
AUDIO TIME @(Book.AudioDuration ?? "N/A")
NARRATOR @(Book.Narrator ?? "None")
@Book.Category.ToUpper()

@Book.Title

By @Book.Author

@for (int i = 0; i < 5; i++) { }
@Book.Rating.ToString("F1") Rating (@Book.ReviewsCount customer reviews)

Overview

@Book.Description

Have you read or listened to this?

@if (UserRating.HasValue) { You rated this title @UserRating.Value star@(UserRating.Value > 1 ? "s" : ""). Thank you! } else { Tap a star to rate this title instantly. }

@for (int starValue = 1; starValue <= 5; starValue++) { var currentStar = starValue; bool isHovered = hoverRating.HasValue && currentStar <= hoverRating.Value; bool isSelected = UserRating.HasValue && currentStar <= UserRating.Value; bool isActive = hoverRating.HasValue ? isHovered : isSelected; } @if (UserRating.HasValue) { @UserRating.Value/5 }

Purchase & Access Formats

PROPRIETARY EBOOK

Read on any device in our premium reader. Offline support.

@if (IsEbookOwned) {
✓ Owned @if (IsEbookCached) { ✓ Cached }
} else { R @Book.Price.ToString("F2") }
STUDIO AUDIOBOOK

High fidelity streaming or offline cached audio player.

@if (IsAudioOwned) { } else { R @((Book.Price * 1.25).ToString("F2")) }
@code { [Parameter] public BookModel Book { get; set; } = new(); [Parameter] public bool IsEbookOwned { get; set; } [Parameter] public bool IsEbookCached { get; set; } [Parameter] public bool IsAudioOwned { get; set; } [Parameter] public bool EbookInCart { get; set; } [Parameter] public bool AudioInCart { get; set; } [Parameter] public int? UserRating { get; set; } [Parameter] public EventCallback OnClose { get; set; } [Parameter] public EventCallback OnAddToCart { get; set; } [Parameter] public EventCallback OnReadEbook { get; set; } [Parameter] public EventCallback OnPlayAudiobook { get; set; } [Parameter] public EventCallback OnRateBook { get; set; } private int? hoverRating = null; private void BuyBook(string format) { OnAddToCart.InvokeAsync(format); } private void ReadEbook() { OnReadEbook.InvokeAsync(); } private void PlayAudiobook() { OnPlayAudiobook.InvokeAsync(); } private void RateBook(int rating) { OnRateBook.InvokeAsync(rating); } }