WIP
This commit is contained in:
21
KTUSAPS.Data/KTUSAPS.Data.csproj
Normal file
21
KTUSAPS.Data/KTUSAPS.Data.csproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.9" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
24
KTUSAPS.Data/Model/Issue.cs
Normal file
24
KTUSAPS.Data/Model/Issue.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KTUSAPS.Data.Model
|
||||
{
|
||||
public class Issue
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
public bool Anonimous { get; set; }
|
||||
public bool Publishable { get; set; }
|
||||
public bool Solved { get; set; } = false;
|
||||
public DateTime Created { get; set; }
|
||||
[MaxLength]
|
||||
public string Description { get; set; }
|
||||
|
||||
public PublishedProblem Problem { get; set; }
|
||||
}
|
||||
}
|
25
KTUSAPS.Data/Model/PublishedFeedback.cs
Normal file
25
KTUSAPS.Data/Model/PublishedFeedback.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KTUSAPS.Data.Model
|
||||
{
|
||||
public class PublishedFeedback
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
[MaxLength]
|
||||
public string FeedbackLt { get; set; }
|
||||
[Required]
|
||||
[MaxLength]
|
||||
public string FeedbackEn { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
public int? IssueId { get; set; }
|
||||
public Issue Issue { get; set; }
|
||||
}
|
||||
}
|
32
KTUSAPS.Data/Model/PublishedProblem.cs
Normal file
32
KTUSAPS.Data/Model/PublishedProblem.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KTUSAPS.Data.Model
|
||||
{
|
||||
public class PublishedProblem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
[MaxLength]
|
||||
public string ProblemLt { get; set; }
|
||||
[Required]
|
||||
[MaxLength]
|
||||
public string ProblemEn { get; set; }
|
||||
[MaxLength]
|
||||
public string ResponseLt { get; set; }
|
||||
[MaxLength]
|
||||
public string ResponseEn { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
public int? IssueId { get; set; }
|
||||
public Issue Issue { get; set; }
|
||||
|
||||
public int? SolutionId { get; set; }
|
||||
public Solution Solution { get; set; }
|
||||
}
|
||||
}
|
18
KTUSAPS.Data/Model/Solution.cs
Normal file
18
KTUSAPS.Data/Model/Solution.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace KTUSAPS.Data.Model
|
||||
{
|
||||
public class Solution
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[MaxLength]
|
||||
public string SolutionLt { get; set; }
|
||||
[MaxLength]
|
||||
public string SolutionEn { get; set; }
|
||||
|
||||
|
||||
public PublishedProblem Problem { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
}
|
||||
}
|
29
KTUSAPS.Data/SAPSDataContext.cs
Normal file
29
KTUSAPS.Data/SAPSDataContext.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KTUSAPS.Data
|
||||
{
|
||||
public class SAPSDataContext : DbContext
|
||||
{
|
||||
public SAPSDataContext() : base() { }
|
||||
public SAPSDataContext(DbContextOptions options) : base(options) { }
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
optionsBuilder.UseMySql("Server=localhost;User=samokdev;Password=;Database=samok_dev", new MariaDbServerVersion(new Version(10, 6, 3)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user