Projektdateien hinzufügen.

This commit is contained in:
BuildTools committed 2024-09-01 21:12:09 +02:00
1 parent 0682df4d16
commit 749bdb5179
142 files changed
+63622

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FWLAZ_Web.Data
{
public class Answer
{
public int Id { get; set; }
public string Position { get; set; } = null!;
public string Text { get; set; } = null!;
public bool IsCorrect { get; set; }
public virtual Question Question { get; set; } = null!;
}
}
+38
View File
@@ -0,0 +1,38 @@
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FWLAZ_Web.Data
{
public class LocalDbContext : DbContext
{
protected readonly IConfiguration configuration;
public DbSet<Quiz> Quiz { get; set; }
public DbSet<QuestionGroup> QuestionGroup { get; set; }
public DbSet<Question> Question { get; set; }
public DbSet<Answer> Answers { get; set; }
public LocalDbContext(IConfiguration configuration)
{
this.configuration = configuration;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite(configuration.GetConnectionString("QuizDB"));
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FWLAZ_Web.Data
{
public class Question
{
public int Id { get; set; }
public int Number { get; set; }
public string Text { get; set; } = null!;
public List<Answer> Answers { get; set; } = new List<Answer>();
public virtual List<QuestionGroup> QuestionGroups { get; set; } = new();
public virtual Quiz Quiz { get; set; } = null!;
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FWLAZ_Web.Data
{
/// <summary>
/// Eine Frage kann zu mehreren QuestionGroups gehören (bspw. hat Bronze die Fragen 1-16, Silber die Fragen 1-24 usw.)
/// </summary>
public class QuestionGroup
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public int Order { get; set; }
public List<Question> Questions { get; set; } = new List<Question>();
public virtual Quiz Quiz { get; set; } = null!;
public QuestionGroup() { }
public QuestionGroup(string name)
{
Name = name;
}
}
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FWLAZ_Web.Data
{
/// <summary>
/// Beispiel:
/// Quiz[0] = Feuerwehr Leistungsabzeichen Rheinland-Pfalz
/// Quiz[1] = Feuerwehr Leistungsabzeichen Baden-Würtemberg
/// </summary>
public class Quiz
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public List<Question> Questions { get; set; } = new();
public List<QuestionGroup> Questiongroups { get; set; } = new();
}
}
Binary file not shown.