This commit is contained in:
Karolis2011
2021-09-08 13:38:31 +03:00
parent b1935f0ffb
commit 3e82ea9392
13 changed files with 2297 additions and 46 deletions

View 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>

View 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; }
}
}

View 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; }
}
}

View 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; }
}
}

View 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; }
}
}

View 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)));
}
}
}
}