Build flashsharp flashcard app
This commit is contained in:
commit
c97759b04c
69 files changed
+6959
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using Flashsharp.Auth;
|
||||
using Flashsharp.Data;
|
||||
using Flashsharp.Domain;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Flashsharp.Pages.Courses;
|
||||
|
||||
public sealed class DetailsModel(Store store) : PageModel
|
||||
{
|
||||
public CourseSummary Course { get; private set; } = null!;
|
||||
|
||||
public IReadOnlyList<LessonSummary> Lessons { get; private set; } = [];
|
||||
|
||||
public async Task<IActionResult> OnGetAsync(long id, CancellationToken cancellationToken)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
var course = await store.GetCourseAsync(id, userId, cancellationToken);
|
||||
if (course is null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Course = course;
|
||||
Lessons = await store.ListLessonsAsync(id, userId, cancellationToken);
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user