CaseAccountingDatabase -> Implements(poka bez realizacii)

CaseAccountingDatabase.cs
This commit is contained in:
Артём Алейкин 2023-04-07 17:55:41 +04:00
parent ff005cfc71
commit 82296e3d23
3 changed files with 99 additions and 1 deletions

View File

@ -7,7 +7,8 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,51 @@
using CaseAccountingDataBaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingDataBaseImplement
{
public class CaseAccountingDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"
Host=localhost;
Port=5432;
Database=CaseAccountingDatabase;
Username=postgres;
Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Case> Cases { set; get; }
public virtual DbSet<User> Users { set; get; }
public virtual DbSet<Role> Roles { set; get; }
public virtual DbSet<Contract> Contracts { set; get; }
public virtual DbSet<Deal> Deals { set; get; }
public virtual DbSet<CaseDeal> CaseDeals { set; get; }
public virtual DbSet<CaseLawyer> CaseLawyers { set; get; }
public virtual DbSet<DealContract> DealContracts { set; get; }
public virtual DbSet<Hearing> Hearings { set; get; }
public virtual DbSet<Lawyer> Lawyers { set; get; }
public virtual DbSet<LawyerContracts> LawyerContracts { set; get; }
public virtual DbSet<Specialization> Specializations { get; set; }
}
}

View File

@ -0,0 +1,46 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingDataBaseImplement.Implements
{
public class HearingStorage : IHearingStorage
{
public HearingViewModel? Delete(HearingBindingModel model)
{
throw new NotImplementedException();
}
public HearingViewModel? GetElement(HearingSearchModel model)
{
throw new NotImplementedException();
}
public List<HearingViewModel> GetFilteredList(HearingSearchModel model)
{
throw new NotImplementedException();
}
public List<HearingViewModel> GetFullList()
{
using var context = new CaseAccountingDatabase();
return context.Hearings.Select(x => x.GetViewModel).ToList();
}
public HearingViewModel? Insert(HearingBindingModel model)
{
throw new NotImplementedException();
}
public HearingViewModel? Update(HearingBindingModel model)
{
throw new NotImplementedException();
}
}
}