création fausse basse de donné

pull/18/head^2
kentin.brongniart 4 months ago
commit 292e724a25

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.WF-WebAdmin.iml
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

@ -0,0 +1,10 @@
namespace WF_WebAdmin.Model
{
public class Commentary
{
public int Id { get; set; }
public int IdUser { get; set; }
public string Text { get; set; }
public DateTime DateCreation { get; set; }
}
}

@ -0,0 +1,12 @@
namespace WF_WebAdmin.Model;
public class Quiz
{
public int Id { get; set; }
public string Question { get; set; }
public string AnswerA { get; set; }
public string AnswerB { get; set; }
public string AnswerC { get; set; }
public string AnswerD { get; set; }
public string CAnswer { get; set; }
}

@ -3,10 +3,13 @@
public class User
{
public int Id { get; set; }
public string Image { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public DateTime DateCreation { get; set; }
public Boolean IsAdmin { get; set; }
public List<Commentary> Comments { get; set; }
}
}

@ -4,9 +4,12 @@
<h3>Gestion des utilisateurs</h3>
@if(users == null)
{
<p><strong>Aucun utilisateur présent sur le site</strong></p>
}
@if (users != null)
else
{
<p>Utilisateurs présents:</p>
@foreach (var user in users)
@ -14,14 +17,45 @@
<div class="userDiv">
<img class="imgProfil" src="@user.Image" />
<p class="idUser"><strong>Identifiant d'utilisateur :</strong> @user.Id</p>
<p class="pseudo"><strong>Nom d'utilisateur :</strong> @user.Name</p>
@if (user.IsAdmin)
{
<p class="pseudo"><strong>Nom d'utilisateur :</strong> @user.Name <strong>(Administrateur)</strong></p>
}
else
{
<p class="pseudo"><strong>Nom d'utilisateur :</strong> @user.Name</p>
}
<p class="mail"><strong>Email de l'utilisateur :</strong> @user.Email</p>
<p class="dateCrea"><strong>Date de création de l'utilisateur :</strong> @user.DateCreation.ToShortDateString()</p>
<p class="dateCrea"><strong>Date de création du compte :</strong> @user.DateCreation.ToShortDateString()</p>
@if(user.Comments != null)
{
@foreach (var comment in user.Comments)
{
<p class="commentaire"><strong>Commentaire (@comment.) :</strong> @comment.Text</p>
}
}
else
{
<p>Aucun commentaire sur le site</p>
}
<button id="DeleteButton" @onclick="() => ShowConfirmation(user)">Supprimer l'utilisateur</button>
@if (!user.IsAdmin)
{
<button id="AdminButton" @onclick="() => ShowConfirmationAdmin(user)">Ajouter en tant qu'administrateur</button>
}
else
{
<button id="AdminButton" @onclick="() => ShowConfirmationAdmin(user)">Retirer en tant qu'administrateur</button>
}
</div>
}
<!-- Fenêtre de confirmation -->
@if (showPopup)
<!-- Fenêtre de confirmation de suppression -->
@if (showPopupDelete)
{
<div class="divPopup">
<div class="contentPopup">
@ -32,12 +66,21 @@
</div>
}
<!-- Fenêtre de confirmation d'ajout admin-->
@if (showPopupAdmin)
{
<div class="divPopup">
<div class="contentPopup">
<p>Êtes-vous sûr de vouloir changer le rôle de cet utilisateur ?</p>
<button @onclick="() => Admin()">Confirmer</button>
<button @onclick="ClosePopup">Annuler</button>
</div>
</div>
}
}
else
{
<p><strong>Aucun utilisateurs présents sur le site</strong></p>
}
@code {

@ -9,8 +9,11 @@ namespace WF_WebAdmin.Pages
private List<User> users;
private bool showPopup = false;
private bool showPopupDelete = false;
private User userToDelete = null;
private bool showPopupAdmin = false;
private User userToAdmin = null;
[Inject]
public HttpClient Http { get; set; }
@ -24,12 +27,11 @@ namespace WF_WebAdmin.Pages
// ------- Popup remove user -------
private void ShowConfirmation(User user)
{
// Afficher la modale et mémoriser l'utilisateur à supprimer
userToDelete = user;
showPopup = true;
showPopupDelete = true;
}
@ -45,8 +47,34 @@ namespace WF_WebAdmin.Pages
private void ClosePopup()
{
showPopup = false;
showPopupDelete = false;
showPopupAdmin = false;
}
// ------- Popup admin -------
private void ShowConfirmationAdmin(User user)
{
userToAdmin = user;
showPopupAdmin = true;
}
private async Task Admin()
{
if (!userToAdmin.IsAdmin)
{
userToAdmin.IsAdmin = true;
ClosePopup();
}
else
{
userToAdmin.IsAdmin = false;
ClosePopup();
}
}
}
}

@ -0,0 +1,11 @@
@page "/ValidQuiz"
@using WF_WebAdmin.Model
<h3> Quiz à valider </h3>
@if (quizzes is null)
{
<p>
Chargement des quiz
</p>
}

@ -0,0 +1,11 @@
using Npgsql;
using WF_WebAdmin.Model;
namespace WF_WebAdmin.Pages
{
public partial class ValidQuiz
{
private List<Quiz> quizzes;
}
}

@ -13,8 +13,9 @@ namespace WF_WebAdmin.Pages
{
// Chaîne de connexion à adapter
private const string connectionString =
"pgsql:host=localhost;dbname=dbkekentin;Username=kekentin;Password=passwd";
//"Host=localhost;Port=5432;Database=wikifantasy3;Username=postgres;Password=postgres";
"Host=localhost;Port=5432;Database=wikifantasy3;Username=postgres;Password=postgres";
//"pgsql:host=localhost;dbname=dbkekentin;Username=kekentin;Password=passwd";
private List<Quote> quotes;
protected override async Task OnInitializedAsync()

@ -25,6 +25,12 @@
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="ValidQuiz">
<span class="oi oi-list-rich" aria-hidden="true"></span> Validation de quiz
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="deleteuser">
<span class="oi oi-list-rich" aria-hidden="true"></span> Gestion des utilisateurs
@ -33,7 +39,7 @@
<div class="nav-item px-3">
<NavLink class="nav-link" href="modifquote">
<span class="oi oi-list-rich" aria-hidden="true"></span> Corection des citation
<span class="oi oi-list-rich" aria-hidden="true"></span> Correction des citations
</NavLink>
</div>

Loading…
Cancel
Save