From e98baf9966a031ca91f9056f8598d7cddb4f45a1 Mon Sep 17 00:00:00 2001 From: "yvan.calatayud" Date: Wed, 17 Jan 2024 16:14:35 +0100 Subject: [PATCH] feat : modif composant --- .../Blazor/Components/CardViewQuestion.razor | 33 +++++++++++++++--- .../Components/CardViewQuestion.razor.cs | 11 +++--- .../Pages/Questions/DisplayQuestions.razor | 34 +------------------ 3 files changed, 34 insertions(+), 44 deletions(-) diff --git a/Blazor/Blazor/Components/CardViewQuestion.razor b/Blazor/Blazor/Components/CardViewQuestion.razor index 0574549..7a33f64 100644 --- a/Blazor/Blazor/Components/CardViewQuestion.razor +++ b/Blazor/Blazor/Components/CardViewQuestion.razor @@ -1,6 +1,29 @@ - -
- @CardHeader - @CardBody - @CardFooter + + +
+

Question n°@Question.Id

+
+
@Question.Content
+
+ +
+ @foreach (var answer in Answers) + { +
+ @if (answer.Id == Question.IdAnswerGood) + { +

@answer.Content

+ } + else + { +

@answer.Content

+ } +
+ } +
+ + + diff --git a/Blazor/Blazor/Components/CardViewQuestion.razor.cs b/Blazor/Blazor/Components/CardViewQuestion.razor.cs index 220bb56..76c1ea1 100644 --- a/Blazor/Blazor/Components/CardViewQuestion.razor.cs +++ b/Blazor/Blazor/Components/CardViewQuestion.razor.cs @@ -1,16 +1,15 @@ -using Microsoft.AspNetCore.Components; +using Blazor.Pages; +using Blazor.ViewClasses; +using Microsoft.AspNetCore.Components; namespace Blazor.Components { public partial class CardViewQuestion { [Parameter] - public RenderFragment CardBody { get; set; } + public Question Question { get; set; } [Parameter] - public RenderFragment CardFooter { get; set; } - - [Parameter] - public RenderFragment CardHeader { get; set; } + public List Answers { get; set; } } } diff --git a/Blazor/Blazor/Pages/Questions/DisplayQuestions.razor b/Blazor/Blazor/Pages/Questions/DisplayQuestions.razor index 0e4df0f..84d9463 100644 --- a/Blazor/Blazor/Pages/Questions/DisplayQuestions.razor +++ b/Blazor/Blazor/Pages/Questions/DisplayQuestions.razor @@ -2,36 +2,4 @@ @using Blazor.Components; - - -
-

Question n°@question.Id

-
-
-
@question.Content
-
-
- -
- @foreach (var answer in answers) - { -
- @if (answer.Id == question.IdAnswerGood) - { -

@answer.Content

- } - else - { -

@answer.Content

- } -
- } -
-
- - - - -
+