Compare commits
2 Commits
bade610548
...
9365dbc456
Author | SHA1 | Date | |
---|---|---|---|
9365dbc456 | |||
c1b4b3b6b8 |
43
School/School.sln
Normal file
43
School/School.sln
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34316.72
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolBusinessLogic", "SchoolBUsinessLogic\SchoolBusinessLogic.csproj", "{4D05633A-E4A6-46EE-B090-A6249FC7DD7A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolContracts", "SchoolContracts\SchoolContracts.csproj", "{CF919E42-3EFD-4846-A1EB-760BFDAE4CA9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolDatabase", "SchoolDatabase\SchoolDatabase.csproj", "{ECF74322-BBF1-452F-9AA0-85243EB1EFD7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolWebApp", "SchoolWebApp\SchoolWebApp.csproj", "{7AEC207D-AC1F-425A-93FC-493452E456AE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4D05633A-E4A6-46EE-B090-A6249FC7DD7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4D05633A-E4A6-46EE-B090-A6249FC7DD7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4D05633A-E4A6-46EE-B090-A6249FC7DD7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4D05633A-E4A6-46EE-B090-A6249FC7DD7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF919E42-3EFD-4846-A1EB-760BFDAE4CA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF919E42-3EFD-4846-A1EB-760BFDAE4CA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF919E42-3EFD-4846-A1EB-760BFDAE4CA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF919E42-3EFD-4846-A1EB-760BFDAE4CA9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ECF74322-BBF1-452F-9AA0-85243EB1EFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ECF74322-BBF1-452F-9AA0-85243EB1EFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ECF74322-BBF1-452F-9AA0-85243EB1EFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ECF74322-BBF1-452F-9AA0-85243EB1EFD7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7AEC207D-AC1F-425A-93FC-493452E456AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7AEC207D-AC1F-425A-93FC-493452E456AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7AEC207D-AC1F-425A-93FC-493452E456AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7AEC207D-AC1F-425A-93FC-493452E456AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {68A74070-18EF-4FF6-BC1F-B7BAAB891399}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
39
School/School/Form1.Designer.cs
generated
Normal file
39
School/School/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace School
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
10
School/School/Form1.cs
Normal file
10
School/School/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace School
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
School/School/Form1.resx
Normal file
120
School/School/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
17
School/School/Program.cs
Normal file
17
School/School/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace School
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
11
School/School/School.csproj
Normal file
11
School/School/School.csproj
Normal file
@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class CoursesForStudyLogic: ICoursesForStudyLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICoursesForStudyStorage _coursesforstudyStorage;
|
||||
public CoursesForStudyLogic(ILogger<CoursesForStudyLogic> logger, ICoursesForStudyStorage coursesforstudyStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_coursesforstudyStorage = coursesforstudyStorage;
|
||||
}
|
||||
public List<CoursesForStudyViewModel>? ReadList(CoursesForStudySearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _coursesforstudyStorage.GetFullList() : _coursesforstudyStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public CoursesForStudyViewModel? ReadElement(CoursesForStudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _coursesforstudyStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(CoursesForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_coursesforstudyStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(CoursesForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_coursesforstudyStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(CoursesForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_coursesforstudyStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(CoursesForStudyBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("CoursesForStudy. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/CoursesLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/CoursesLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class CoursesLogic: ICoursesLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICoursesStorage _coursesStorage;
|
||||
public CoursesLogic(ILogger<CoursesLogic> logger, ICoursesStorage coursesStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_coursesStorage = coursesStorage;
|
||||
}
|
||||
public List<CoursesViewModel>? ReadList(CoursesSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _coursesStorage.GetFullList() : _coursesStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public CoursesViewModel? ReadElement(CoursesSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _coursesStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(CoursesBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_coursesStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(CoursesBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_coursesStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(CoursesBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_coursesStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(CoursesBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Courses. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/CustomerLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/CustomerLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class CustomerLogic : ICustomerLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICustumerStorage _customerStorage;
|
||||
public CustomerLogic(ILogger<CustomerLogic> logger, ICustumerStorage customerStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_customerStorage = customerStorage;
|
||||
}
|
||||
public List<CustumerViewModel>? ReadList(CustumerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _customerStorage.GetFullList() : _customerStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public CustumerViewModel? ReadElement(CustumerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _customerStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(CustomerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_customerStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(CustomerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_customerStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(CustomerBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_customerStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(CustomerBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Customer. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class ItemForStudyLogic: IItemForStudyLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IItemForStudyStorage _itemforstudyStorage;
|
||||
public ItemForStudyLogic(ILogger<ItemForStudyLogic> logger, IItemForStudyStorage itemforstudyStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_itemforstudyStorage = itemforstudyStorage;
|
||||
}
|
||||
public List<ItemForStudyViewModel>? ReadList(ItemForStudySearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _itemforstudyStorage.GetFullList() : _itemforstudyStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public ItemForStudyViewModel? ReadElement(ItemForStudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _itemforstudyStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(ItemForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_itemforstudyStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(ItemForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_itemforstudyStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(ItemForStudyBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_itemforstudyStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(ItemForStudyBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("ItemForStudy. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/ItemLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/ItemLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class ItemLogic: IItemLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IItemStorage _itemStorage;
|
||||
public ItemLogic(ILogger<ItemLogic> logger, IItemStorage itemStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_itemStorage = itemStorage;
|
||||
}
|
||||
public List<ItemViewModel>? ReadList(ItemSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _itemStorage.GetFullList() : _itemStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public ItemViewModel? ReadElement(ItemSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _itemStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(ItemBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_itemStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(ItemBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_itemStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(ItemBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_itemStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(ItemBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Item. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/PaymentLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/PaymentLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class PaymentLogic: IPaymentLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPaymentStorage _paymentStorage;
|
||||
public PaymentLogic(ILogger<PaymentLogic> logger, IPaymentStorage paymentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_paymentStorage = paymentStorage;
|
||||
}
|
||||
public List<PaymentViewModel>? ReadList(PaymentSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _paymentStorage.GetFullList() : _paymentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public PaymentViewModel? ReadElement(PaymentSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _paymentStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(PaymentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_paymentStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(PaymentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_paymentStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(PaymentBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_paymentStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(PaymentBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Payment. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/StudyLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/StudyLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class StudyLogic: IStudyLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStudyStorage _studyStorage;
|
||||
public StudyLogic(ILogger<StudyLogic> logger, IStudyStorage studyStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_studyStorage = studyStorage;
|
||||
}
|
||||
public List<StudyViewModel>? ReadList(StudySearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _studyStorage.GetFullList() : _studyStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public StudyViewModel? ReadElement(StudySearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _studyStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(StudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_studyStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(StudyBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_studyStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(StudyBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_studyStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(StudyBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Study. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
96
School/SchoolBUsinessLogic/BusinessLogic/WorkerLogic.cs
Normal file
96
School/SchoolBUsinessLogic/BusinessLogic/WorkerLogic.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StorageContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class WorkerLogic : IWorkerLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWorkerStorage _workerStorage;
|
||||
public WorkerLogic(ILogger<WorkerLogic> logger, IWorkerStorage workerStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_workerStorage = workerStorage;
|
||||
}
|
||||
public List<WorkerViewModel>? ReadList(WorkerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}", model?.Id);
|
||||
var list = model == null ? _workerStorage.GetFullList() : _workerStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public WorkerViewModel? ReadElement(WorkerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id: {Id}", model.Id);
|
||||
var element = _workerStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_workerStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(WorkerBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Worker. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
22
School/SchoolBUsinessLogic/SchoolBusinessLogic.csproj
Normal file
22
School/SchoolBUsinessLogic/SchoolBusinessLogic.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SchoolContracts\SchoolContracts.csproj" />
|
||||
<ProjectReference Include="..\SchoolDatabase\SchoolDatabase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
School/SchoolContracts/BindingModels/CoursesBindingModel.cs
Normal file
22
School/SchoolContracts/BindingModels/CoursesBindingModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class CoursesBindingModel: ICoursesModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public decimal Price { get; }
|
||||
|
||||
public decimal Duration { get; }
|
||||
|
||||
public int WorkerId { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class CoursesForStudyBindingModel: ICoursesForStudy
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public decimal TotalTime { get; }
|
||||
public int StudyId { get; }
|
||||
public int CoursesId { get; }
|
||||
}
|
||||
}
|
17
School/SchoolContracts/BindingModels/CustumerBindingModel.cs
Normal file
17
School/SchoolContracts/BindingModels/CustumerBindingModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class CustomerBindingModel: ICustumerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
20
School/SchoolContracts/BindingModels/ItemBindingModel.cs
Normal file
20
School/SchoolContracts/BindingModels/ItemBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class ItemBindingModel: IItemModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public decimal Price { get; }
|
||||
|
||||
public int WorkerId { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class ItemForStudyBindingModel: IItemForStudyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ItemId { get; }
|
||||
|
||||
public int StudyId { get; }
|
||||
}
|
||||
}
|
20
School/SchoolContracts/BindingModels/PaymentBindingModel.cs
Normal file
20
School/SchoolContracts/BindingModels/PaymentBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class PaymentBindingModel: IPaymentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime DatePayment { get; }
|
||||
|
||||
public decimal Sum { get; }
|
||||
|
||||
public int CoursesForStudyId { get; }
|
||||
}
|
||||
}
|
20
School/SchoolContracts/BindingModels/StudyBindingModel.cs
Normal file
20
School/SchoolContracts/BindingModels/StudyBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class StudyBindingModel: IStudyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime DateCreated { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime DateСompletion { get; set; } = DateTime.Now;
|
||||
|
||||
public int CustumerId { get; set; }
|
||||
|
||||
}
|
||||
}
|
19
School/SchoolContracts/BindingModels/WorkerBindingModel.cs
Normal file
19
School/SchoolContracts/BindingModels/WorkerBindingModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class WorkerBindingModel : IWorkerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Post { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICoursesForStudyLogic
|
||||
{
|
||||
List<CoursesForStudyViewModel>? ReadList(CoursesForStudySearchModel? model);
|
||||
CoursesForStudyViewModel? ReadElement(CoursesForStudySearchModel model);
|
||||
bool Create(CoursesForStudyBindingModel model);
|
||||
bool Update(CoursesForStudyBindingModel model);
|
||||
bool Delete(CoursesForStudyBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICoursesLogic
|
||||
{
|
||||
List<CoursesViewModel>? ReadList(CoursesSearchModel? model);
|
||||
CoursesViewModel? ReadElement(CoursesSearchModel model);
|
||||
bool Create(CoursesBindingModel model);
|
||||
bool Update(CoursesBindingModel model);
|
||||
bool Delete(CoursesBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICustomerLogic
|
||||
{
|
||||
List<CustumerViewModel>? ReadList(CustumerSearchModel? model);
|
||||
CustumerViewModel? ReadElement(CustumerSearchModel model);
|
||||
bool Create(CustomerBindingModel model);
|
||||
bool Update(CustomerBindingModel model);
|
||||
bool Delete(CustomerBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IItemForStudyLogic
|
||||
{
|
||||
List<ItemForStudyViewModel>? ReadList(ItemForStudySearchModel? model);
|
||||
ItemForStudyViewModel? ReadElement(ItemForStudySearchModel model);
|
||||
bool Create(ItemForStudyBindingModel model);
|
||||
bool Update(ItemForStudyBindingModel model);
|
||||
bool Delete(ItemForStudyBindingModel model);
|
||||
}
|
||||
}
|
20
School/SchoolContracts/BusinessLogicsContracts/IItemLogic.cs
Normal file
20
School/SchoolContracts/BusinessLogicsContracts/IItemLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IItemLogic
|
||||
{
|
||||
List<ItemViewModel>? ReadList(ItemSearchModel? model);
|
||||
ItemViewModel? ReadElement(ItemSearchModel model);
|
||||
bool Create(ItemBindingModel model);
|
||||
bool Update(ItemBindingModel model);
|
||||
bool Delete(ItemBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IPaymentLogic
|
||||
{
|
||||
List<PaymentViewModel>? ReadList(PaymentSearchModel? model);
|
||||
PaymentViewModel? ReadElement(PaymentSearchModel model);
|
||||
bool Create(PaymentBindingModel model);
|
||||
bool Update(PaymentBindingModel model);
|
||||
bool Delete(PaymentBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IStudyLogic
|
||||
{
|
||||
List<StudyViewModel>? ReadList(StudySearchModel? model);
|
||||
StudyViewModel? ReadElement(StudySearchModel model);
|
||||
bool Create(StudyBindingModel model);
|
||||
bool Update(StudyBindingModel model);
|
||||
bool Delete(StudyBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IWorkerLogic
|
||||
{
|
||||
List<WorkerViewModel>? ReadList(WorkerSearchModel? model);
|
||||
WorkerViewModel? ReadElement(WorkerSearchModel model);
|
||||
bool Create(WorkerBindingModel model);
|
||||
bool Update(WorkerBindingModel model);
|
||||
bool Delete(WorkerBindingModel model);
|
||||
}
|
||||
}
|
15
School/SchoolContracts/Id/IId.cs
Normal file
15
School/SchoolContracts/Id/IId.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Id
|
||||
{
|
||||
// Id каждой сущности
|
||||
public interface IId
|
||||
{
|
||||
// Id
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/Models/ICoursesForStudy.cs
Normal file
22
School/SchoolContracts/Models/ICoursesForStudy.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.Id;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Курсы в обучении
|
||||
public interface ICoursesForStudy: IId
|
||||
{
|
||||
// Общее время
|
||||
decimal TotalTime { get; }
|
||||
|
||||
//Id обучения
|
||||
int StudyId { get; }
|
||||
|
||||
//Id курса
|
||||
int CoursesId { get; }
|
||||
}
|
||||
}
|
23
School/SchoolContracts/Models/ICoursesModel.cs
Normal file
23
School/SchoolContracts/Models/ICoursesModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
public interface ICoursesModel: IId
|
||||
{
|
||||
// Наименование
|
||||
string Name { get; }
|
||||
|
||||
// Цена
|
||||
decimal Price { get; }
|
||||
|
||||
// Продолжительность
|
||||
decimal Duration { get; }
|
||||
|
||||
int WorkerId { get; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/Models/ICustumerModel.cs
Normal file
22
School/SchoolContracts/Models/ICustumerModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Сотрудник
|
||||
public interface ICustumerModel : IId
|
||||
{
|
||||
// Логин
|
||||
string Login { get; }
|
||||
|
||||
// Пароль
|
||||
string Password { get; }
|
||||
|
||||
// ФИО
|
||||
string FIO { get; }
|
||||
}
|
||||
}
|
19
School/SchoolContracts/Models/IItemForStudyModel.cs
Normal file
19
School/SchoolContracts/Models/IItemForStudyModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Затрата на обучение
|
||||
public interface IItemForStudyModel : IId
|
||||
{
|
||||
// Id затрат
|
||||
int ItemId { get; }
|
||||
|
||||
// Id обучени
|
||||
int StudyId { get; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/Models/IItemModels.cs
Normal file
22
School/SchoolContracts/Models/IItemModels.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Затраты
|
||||
public interface IItemModel : IId
|
||||
{
|
||||
// Наименование
|
||||
string Name { get; }
|
||||
|
||||
// Цена
|
||||
decimal Price { get; }
|
||||
|
||||
// Id сотрудника
|
||||
int WorkerId { get; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/Models/IPaymentModel.cs
Normal file
22
School/SchoolContracts/Models/IPaymentModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Оплата
|
||||
public interface IPaymentModel : IId
|
||||
{
|
||||
// Дата оплаты
|
||||
DateTime DatePayment { get; }
|
||||
|
||||
// Сумма
|
||||
decimal Sum { get; }
|
||||
|
||||
// Id курса в обучении
|
||||
int CoursesForStudyId { get; }
|
||||
}
|
||||
}
|
23
School/SchoolContracts/Models/IStudyModel.cs
Normal file
23
School/SchoolContracts/Models/IStudyModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Обучение
|
||||
public interface IStudyModel : IId
|
||||
{
|
||||
// Дата оформления
|
||||
DateTime DateCreated { get; }
|
||||
|
||||
// Дата прохождения
|
||||
DateTime DateСompletion { get; }
|
||||
|
||||
//Id клиента
|
||||
int CustumerId { get; }
|
||||
}
|
||||
}
|
28
School/SchoolContracts/Models/IWorkerModel.cs
Normal file
28
School/SchoolContracts/Models/IWorkerModel.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using SchoolContracts.Id;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.Models
|
||||
{
|
||||
// Клиент
|
||||
public interface IWorkerModel : IId
|
||||
{
|
||||
// Логин
|
||||
string Login { get; }
|
||||
|
||||
// почта
|
||||
string Email { get; }
|
||||
|
||||
// ФИО
|
||||
string FIO { get; }
|
||||
|
||||
// Должность
|
||||
string Post { get; }
|
||||
|
||||
// Пароль
|
||||
string Password { get; }
|
||||
}
|
||||
}
|
9
School/SchoolContracts/SchoolContracts.csproj
Normal file
9
School/SchoolContracts/SchoolContracts.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class CoursesForStudySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public List<int>? CourseId { get; set; }
|
||||
public List<int>? StudyId { get; set; }
|
||||
}
|
||||
}
|
15
School/SchoolContracts/SearchModels/CoursesSearchModel.cs
Normal file
15
School/SchoolContracts/SearchModels/CoursesSearchModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class CoursesSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
}
|
||||
}
|
13
School/SchoolContracts/SearchModels/CustumerSearchModel.cs
Normal file
13
School/SchoolContracts/SearchModels/CustumerSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class CustumerSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class ItemForStudySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? ItemId { get; set; }
|
||||
}
|
||||
}
|
14
School/SchoolContracts/SearchModels/ItemSearchModel.cs
Normal file
14
School/SchoolContracts/SearchModels/ItemSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class ItemSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
18
School/SchoolContracts/SearchModels/PaymentSearchModel.cs
Normal file
18
School/SchoolContracts/SearchModels/PaymentSearchModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class PaymentSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public DateTime? DatePayment { get; }
|
||||
|
||||
// Id выбранных курсов
|
||||
public List<int>? SelectedCoursesId { get; set; }
|
||||
}
|
||||
}
|
13
School/SchoolContracts/SearchModels/StudySearchModel.cs
Normal file
13
School/SchoolContracts/SearchModels/StudySearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class StudySearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
19
School/SchoolContracts/SearchModels/WorkerSearchModel.cs
Normal file
19
School/SchoolContracts/SearchModels/WorkerSearchModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class WorkerSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
// Поиск по логину для проверки логина на уникальность и для входа
|
||||
public string? Login { get; set; }
|
||||
|
||||
// Поиск по паролю для входа
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface ICoursesForStudyStorage
|
||||
{
|
||||
List<CoursesForStudyViewModel> GetFullList();
|
||||
List<CoursesForStudyViewModel> GetFilteredList(CoursesForStudySearchModel model);
|
||||
CoursesForStudyViewModel? GetElement(CoursesForStudySearchModel model);
|
||||
CoursesForStudyViewModel? Insert(CoursesForStudyBindingModel model);
|
||||
CoursesForStudyViewModel? Update(CoursesForStudyBindingModel model);
|
||||
CoursesForStudyViewModel? Delete(CoursesForStudyBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StorageContracts/ICoursesStorage.cs
Normal file
21
School/SchoolContracts/StorageContracts/ICoursesStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface ICoursesStorage
|
||||
{
|
||||
List<CoursesViewModel> GetFullList();
|
||||
List<CoursesViewModel> GetFilteredList(CoursesSearchModel model);
|
||||
CoursesViewModel? GetElement(CoursesSearchModel model);
|
||||
CoursesViewModel? Insert(CoursesBindingModel model);
|
||||
CoursesViewModel? Update(CoursesBindingModel model);
|
||||
CoursesViewModel? Delete(CoursesBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StorageContracts/ICustumerStorage.cs
Normal file
21
School/SchoolContracts/StorageContracts/ICustumerStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface ICustumerStorage
|
||||
{
|
||||
List<CustumerViewModel> GetFullList();
|
||||
List<CustumerViewModel> GetFilteredList(CustumerSearchModel model);
|
||||
CustumerViewModel? GetElement(CustumerSearchModel model);
|
||||
CustumerViewModel? Insert(CustomerBindingModel model);
|
||||
CustumerViewModel? Update(CustomerBindingModel model);
|
||||
CustumerViewModel? Delete(CustomerBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface IItemForStudyStorage
|
||||
{
|
||||
List<ItemForStudyViewModel> GetFullList();
|
||||
List<ItemForStudyViewModel> GetFilteredList(ItemForStudySearchModel model);
|
||||
ItemForStudyViewModel? GetElement(ItemForStudySearchModel model);
|
||||
ItemForStudyViewModel? Insert(ItemForStudyBindingModel model);
|
||||
ItemForStudyViewModel? Update(ItemForStudyBindingModel model);
|
||||
ItemForStudyViewModel? Delete(ItemForStudyBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StorageContracts/IItemStorage.cs
Normal file
21
School/SchoolContracts/StorageContracts/IItemStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface IItemStorage
|
||||
{
|
||||
List<ItemViewModel> GetFullList();
|
||||
List<ItemViewModel> GetFilteredList(ItemSearchModel model);
|
||||
ItemViewModel? GetElement(ItemSearchModel model);
|
||||
ItemViewModel? Insert(ItemBindingModel model);
|
||||
ItemViewModel? Update(ItemBindingModel model);
|
||||
ItemViewModel? Delete(ItemBindingModel model);
|
||||
}
|
||||
}
|
22
School/SchoolContracts/StorageContracts/IPaymentStorage.cs
Normal file
22
School/SchoolContracts/StorageContracts/IPaymentStorage.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface IPaymentStorage
|
||||
{
|
||||
List<PaymentViewModel> GetFullList();
|
||||
List<PaymentViewModel> GetFilteredList(PaymentSearchModel model);
|
||||
PaymentViewModel? GetElement(PaymentSearchModel model);
|
||||
List<PaymentViewModel> GetPaymentsByCourses(PaymentSearchModel model);
|
||||
PaymentViewModel? Insert(PaymentBindingModel model);
|
||||
PaymentViewModel? Update(PaymentBindingModel model);
|
||||
PaymentViewModel? Delete(PaymentBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StorageContracts/IStudyStorage.cs
Normal file
21
School/SchoolContracts/StorageContracts/IStudyStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface IStudyStorage
|
||||
{
|
||||
List<StudyViewModel> GetFullList();
|
||||
List<StudyViewModel> GetFilteredList(StudySearchModel model);
|
||||
StudyViewModel? GetElement(StudySearchModel model);
|
||||
StudyViewModel? Insert(StudyBindingModel model);
|
||||
StudyViewModel? Update(StudyBindingModel model);
|
||||
StudyViewModel? Delete(StudyBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StorageContracts/IWorkerStorage.cs
Normal file
21
School/SchoolContracts/StorageContracts/IWorkerStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StorageContracts
|
||||
{
|
||||
public interface IWorkerStorage
|
||||
{
|
||||
List<WorkerViewModel> GetFullList();
|
||||
List<WorkerViewModel> GetFilteredList(WorkerSearchModel model);
|
||||
WorkerViewModel? GetElement(WorkerSearchModel model);
|
||||
WorkerViewModel? Insert(WorkerBindingModel model);
|
||||
WorkerViewModel? Update(WorkerBindingModel model);
|
||||
WorkerViewModel? Delete(WorkerBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class CoursesForStudyViewModel: ICoursesForStudy
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Общее время")]
|
||||
public decimal TotalTime { get; set; }
|
||||
public int StudyId { get; set; }
|
||||
public int CoursesId { get; set; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/ViewModels/CoursesViewModel.cs
Normal file
22
School/SchoolContracts/ViewModels/CoursesViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class CoursesViewModel: ICoursesModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Наименование")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
public decimal Price { get; set; }
|
||||
[DisplayName("Длительность")]
|
||||
public decimal Duration { get; set; }
|
||||
public int WorkerId { get; set; }
|
||||
}
|
||||
}
|
21
School/SchoolContracts/ViewModels/CustumerViewModel.cs
Normal file
21
School/SchoolContracts/ViewModels/CustumerViewModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class CustumerViewModel : ICustumerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Логин")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
20
School/SchoolContracts/ViewModels/ItemForStudyViewModel.cs
Normal file
20
School/SchoolContracts/ViewModels/ItemForStudyViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class ItemForStudyViewModel: IItemForStudyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ItemId { get; set; }
|
||||
[DisplayName("Номер обучения")]
|
||||
public int StudyId { get; set; }
|
||||
[DisplayName("Статья затрат")]
|
||||
public string ItemName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
22
School/SchoolContracts/ViewModels/ItemViewModel.cs
Normal file
22
School/SchoolContracts/ViewModels/ItemViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class ItemViewModel: IItemModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Наименование")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
public decimal Price { get; set; }
|
||||
public int WorkerId { get; set; }
|
||||
[DisplayName("Сотрудник")]
|
||||
public string WorkerName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
20
School/SchoolContracts/ViewModels/PaymentViewModel.cs
Normal file
20
School/SchoolContracts/ViewModels/PaymentViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class PaymentViewModel: IPaymentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Дата оплаты")]
|
||||
public DateTime DatePayment { get; set; }
|
||||
[DisplayName("Сумма")]
|
||||
public decimal Sum { get; set; }
|
||||
public int CoursesForStudyId { get; set; }
|
||||
}
|
||||
}
|
23
School/SchoolContracts/ViewModels/StudyViewModel.cs
Normal file
23
School/SchoolContracts/ViewModels/StudyViewModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class StudyViewModel: IStudyModel
|
||||
{
|
||||
[DisplayName("Номер обучения")]
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Дата оформления")]
|
||||
public DateTime DateCreated { get; set; } = DateTime.Now;
|
||||
[DisplayName("Дата прохождения")]
|
||||
public DateTime DateСompletion { get; set; } = DateTime.Now;
|
||||
public int CustumerId { get; set; }
|
||||
public string CustumerFIO { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
25
School/SchoolContracts/ViewModels/WorkerViewModel.cs
Normal file
25
School/SchoolContracts/ViewModels/WorkerViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class WorkerViewModel : IWorkerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Логин")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
[DisplayName("Должность")]
|
||||
public string Post { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
353
School/SchoolDatabase/Migrations/20240429105856_SchoolMigration.Designer.cs
generated
Normal file
353
School/SchoolDatabase/Migrations/20240429105856_SchoolMigration.Designer.cs
generated
Normal file
@ -0,0 +1,353 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SchoolDatabase;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SchoolDatabase.Migrations
|
||||
{
|
||||
[DbContext(typeof(SchoolDbContext))]
|
||||
[Migration("20240429105856_SchoolMigration")]
|
||||
partial class SchoolMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Duration")
|
||||
.HasColumnType("decimal (3,1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Coursess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CoursesId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TotalTime")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CoursesId");
|
||||
|
||||
b.HasIndex("StudyId");
|
||||
|
||||
b.ToTable("CoursessForStudys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Custumers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("StudyId");
|
||||
|
||||
b.ToTable("ItemForStudys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CoursesForStudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DatePayment")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<decimal>("Sum")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CoursesForStudyId");
|
||||
|
||||
b.ToTable("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CustumerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateTime>("DateСompletion")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.ToTable("Studys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Post")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Courses")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Courses", null)
|
||||
.WithMany("CoursessForStudy")
|
||||
.HasForeignKey("CoursesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabase.Models.Study", null)
|
||||
.WithMany("CoursessForStudy")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Item", "Item")
|
||||
.WithMany("ItemForStudy")
|
||||
.HasForeignKey("ItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabase.Models.Study", "Study")
|
||||
.WithMany("ItemsForStudy")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Study");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.CoursesForStudy", "CoursesForStudy")
|
||||
.WithMany("Payments")
|
||||
.HasForeignKey("CoursesForStudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CoursesForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Custumer", "Custumer")
|
||||
.WithMany("Study")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Custumer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.Navigation("CoursessForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.Navigation("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
|
||||
{
|
||||
b.Navigation("Study");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.Navigation("ItemForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.Navigation("CoursessForStudy");
|
||||
|
||||
b.Navigation("ItemsForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Navigation("Courses");
|
||||
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,254 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SchoolDatabase.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SchoolMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Custumers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Custumers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Workers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Post = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Workers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Studys",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DateCreated = table.Column<DateTime>(type: "date", nullable: false),
|
||||
DateСompletion = table.Column<DateTime>(type: "date", nullable: false),
|
||||
CustumerId = table.Column<int>(type: "int", nullable: false),
|
||||
CustomerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Studys", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Studys_Custumers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalTable: "Custumers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Coursess",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
|
||||
Duration = table.Column<decimal>(type: "decimal(3,1)", nullable: false),
|
||||
WorkerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Coursess", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Coursess_Workers_WorkerId",
|
||||
column: x => x.WorkerId,
|
||||
principalTable: "Workers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Items",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
|
||||
WorkerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Items", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Items_Workers_WorkerId",
|
||||
column: x => x.WorkerId,
|
||||
principalTable: "Workers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CoursessForStudys",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TotalTime = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
|
||||
StudyId = table.Column<int>(type: "int", nullable: false),
|
||||
CoursesId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CoursessForStudys", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CoursessForStudys_Coursess_CoursesId",
|
||||
column: x => x.CoursesId,
|
||||
principalTable: "Coursess",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CoursessForStudys_Studys_StudyId",
|
||||
column: x => x.StudyId,
|
||||
principalTable: "Studys",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ItemForStudys",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ItemId = table.Column<int>(type: "int", nullable: false),
|
||||
StudyId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ItemForStudys", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ItemForStudys_Items_ItemId",
|
||||
column: x => x.ItemId,
|
||||
principalTable: "Items",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ItemForStudys_Studys_StudyId",
|
||||
column: x => x.StudyId,
|
||||
principalTable: "Studys",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Payments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DatePayment = table.Column<DateTime>(type: "date", nullable: false),
|
||||
Sum = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
|
||||
CoursesForStudyId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Payments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Payments_CoursessForStudys_CoursesForStudyId",
|
||||
column: x => x.CoursesForStudyId,
|
||||
principalTable: "CoursessForStudys",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Coursess_WorkerId",
|
||||
table: "Coursess",
|
||||
column: "WorkerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CoursessForStudys_CoursesId",
|
||||
table: "CoursessForStudys",
|
||||
column: "CoursesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CoursessForStudys_StudyId",
|
||||
table: "CoursessForStudys",
|
||||
column: "StudyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ItemForStudys_ItemId",
|
||||
table: "ItemForStudys",
|
||||
column: "ItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ItemForStudys_StudyId",
|
||||
table: "ItemForStudys",
|
||||
column: "StudyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Items_WorkerId",
|
||||
table: "Items",
|
||||
column: "WorkerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Payments_CoursesForStudyId",
|
||||
table: "Payments",
|
||||
column: "CoursesForStudyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Studys_CustomerId",
|
||||
table: "Studys",
|
||||
column: "CustomerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ItemForStudys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Payments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CoursessForStudys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Coursess");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Studys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Workers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Custumers");
|
||||
}
|
||||
}
|
||||
}
|
350
School/SchoolDatabase/Migrations/SchoolDbContextModelSnapshot.cs
Normal file
350
School/SchoolDatabase/Migrations/SchoolDbContextModelSnapshot.cs
Normal file
@ -0,0 +1,350 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SchoolDatabase;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SchoolDatabase.Migrations
|
||||
{
|
||||
[DbContext(typeof(SchoolDbContext))]
|
||||
partial class SchoolDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Duration")
|
||||
.HasColumnType("decimal (3,1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Coursess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CoursesId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("TotalTime")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CoursesId");
|
||||
|
||||
b.HasIndex("StudyId");
|
||||
|
||||
b.ToTable("CoursessForStudys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Custumers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("StudyId");
|
||||
|
||||
b.ToTable("ItemForStudys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CoursesForStudyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DatePayment")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<decimal>("Sum")
|
||||
.HasColumnType("decimal (10,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CoursesForStudyId");
|
||||
|
||||
b.ToTable("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CustumerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<DateTime>("DateСompletion")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.ToTable("Studys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Post")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Courses")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Courses", null)
|
||||
.WithMany("CoursessForStudy")
|
||||
.HasForeignKey("CoursesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabase.Models.Study", null)
|
||||
.WithMany("CoursessForStudy")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Item", "Item")
|
||||
.WithMany("ItemForStudy")
|
||||
.HasForeignKey("ItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabase.Models.Study", "Study")
|
||||
.WithMany("ItemsForStudy")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Study");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.CoursesForStudy", "CoursesForStudy")
|
||||
.WithMany("Payments")
|
||||
.HasForeignKey("CoursesForStudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CoursesForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabase.Models.Custumer", "Custumer")
|
||||
.WithMany("Study")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Custumer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
|
||||
{
|
||||
b.Navigation("CoursessForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
|
||||
{
|
||||
b.Navigation("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
|
||||
{
|
||||
b.Navigation("Study");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
|
||||
{
|
||||
b.Navigation("ItemForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
|
||||
{
|
||||
b.Navigation("CoursessForStudy");
|
||||
|
||||
b.Navigation("ItemsForStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Navigation("Courses");
|
||||
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
64
School/SchoolDatabase/Models/Courses.cs
Normal file
64
School/SchoolDatabase/Models/Courses.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Courses: ICoursesModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
[Required, Column(TypeName = "decimal (10,2)")]
|
||||
public decimal Price { get; private set; }
|
||||
[Required, Column(TypeName = "decimal (3,1)")]
|
||||
public decimal Duration { get; private set; }
|
||||
[Required]
|
||||
public int WorkerId { get; private set; }
|
||||
|
||||
// Курсы в обучении
|
||||
[ForeignKey("CoursesId")]
|
||||
public virtual List<CoursesForStudy> CoursessForStudy { get; set; } = new();
|
||||
public virtual Worker Worker { get; set; } = new();
|
||||
public static Courses? Create(SchoolDbContext context, CoursesBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Name = model.Name,
|
||||
Price = model.Price,
|
||||
Duration = model.Duration,
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId)
|
||||
};
|
||||
}
|
||||
public void Update(SchoolDbContext context, CoursesBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
Price = model.Price;
|
||||
Duration = model.Duration;
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId);
|
||||
}
|
||||
public CoursesViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Price = Price,
|
||||
Duration = Duration,
|
||||
WorkerId = WorkerId,
|
||||
};
|
||||
}
|
||||
}
|
70
School/SchoolDatabase/Models/CoursesForStudy.cs
Normal file
70
School/SchoolDatabase/Models/CoursesForStudy.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class CoursesForStudy: ICoursesForStudy
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required, Column(TypeName = "decimal (10,2)")]
|
||||
public decimal TotalTime { get; private set; }
|
||||
[Required]
|
||||
public int StudyId { get; private set; }
|
||||
[Required]
|
||||
public int CoursesId { get; private set; }
|
||||
|
||||
// Оплаты за обучение
|
||||
[ForeignKey("CoursesForStudyId")]
|
||||
public virtual List<Payment> Payments { get; set; } = new();
|
||||
public static CoursesForStudy? Create(CoursesForStudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Id = model.Id,
|
||||
TotalTime = model.TotalTime,
|
||||
StudyId = model.StudyId,
|
||||
CoursesId = model.CoursesId
|
||||
};
|
||||
}
|
||||
public static CoursesForStudy Create(CoursesForStudyViewModel model)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Id = model.Id,
|
||||
TotalTime = model.TotalTime,
|
||||
StudyId = model.StudyId,
|
||||
CoursesId = model.CoursesId
|
||||
};
|
||||
}
|
||||
public void Update(CoursesForStudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Id = model.Id;
|
||||
TotalTime = model.TotalTime;
|
||||
StudyId = model.StudyId;
|
||||
CoursesId = model.CoursesId;
|
||||
}
|
||||
public CoursesForStudyViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
TotalTime = TotalTime,
|
||||
StudyId = StudyId,
|
||||
CoursesId = CoursesId
|
||||
};
|
||||
}
|
||||
}
|
70
School/SchoolDatabase/Models/Custumer.cs
Normal file
70
School/SchoolDatabase/Models/Custumer.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Custumer : ICustumerModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Login { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Password { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string FIO { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
|
||||
// Обучение
|
||||
[ForeignKey("CustomerId")]
|
||||
public virtual List<Study> Study { get; set; } = new();
|
||||
public static Custumer? Create(CustomerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
Password = model.Password,
|
||||
FIO = model.FIO,
|
||||
};
|
||||
}
|
||||
public static Custumer Create(CustumerViewModel model)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
Password = model.Password,
|
||||
FIO = model.FIO
|
||||
};
|
||||
}
|
||||
public void Update(CustomerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
Password = model.Password;
|
||||
FIO = model.FIO;
|
||||
}
|
||||
public CustumerViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
FIO = FIO
|
||||
};
|
||||
}
|
||||
}
|
62
School/SchoolDatabase/Models/Item.cs
Normal file
62
School/SchoolDatabase/Models/Item.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Item : IItemModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
[Required, Column(TypeName = "decimal (10,2)")]
|
||||
public decimal Price { get; private set; }
|
||||
[Required]
|
||||
public int WorkerId { get; private set; }
|
||||
|
||||
// Затраты на обучение
|
||||
[ForeignKey("ItemId")]
|
||||
public virtual List<ItemForStudy> ItemForStudy { get; set; } = new();
|
||||
public virtual Worker Worker { get; set; } = new();
|
||||
public static Item? Create(SchoolDbContext context, ItemBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Name = model.Name,
|
||||
Price = model.Price,
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId)
|
||||
};
|
||||
}
|
||||
public void Update(SchoolDbContext context, ItemBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
Price = model.Price;
|
||||
Worker = context.Workers.First(x => x.Id == model.WorkerId);
|
||||
}
|
||||
|
||||
public ItemViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Price = Price,
|
||||
WorkerId = WorkerId
|
||||
//,WorkerFIO = Worker.FIO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
57
School/SchoolDatabase/Models/ItemForStudy.cs
Normal file
57
School/SchoolDatabase/Models/ItemForStudy.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using SchoolContracts.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class ItemForStudy : IItemForStudyModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int ItemId { get; private set; }
|
||||
[Required]
|
||||
public int StudyId { get; private set; }
|
||||
public virtual Item Item { get; set; } = new();
|
||||
public virtual Study Study { get; set; } = new();
|
||||
|
||||
public static ItemForStudy? Create(SchoolDbContext context, ItemForStudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemForStudy
|
||||
{
|
||||
Item = context.Items.First(x => x.Id == model.ItemId),
|
||||
Study = context.Studys.First(x => x.Id == model.StudyId)
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(SchoolDbContext context, ItemForStudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Item = context.Items.First(x => x.Id == model.ItemId);
|
||||
Study = context.Studys.First(x => x.Id == model.StudyId);
|
||||
}
|
||||
|
||||
public ItemForStudyViewModel GetViewModel => new ItemForStudyViewModel
|
||||
{
|
||||
Id = Id,
|
||||
ItemId = ItemId,
|
||||
StudyId = StudyId,
|
||||
ItemName = Item.Name
|
||||
};
|
||||
}
|
||||
}
|
55
School/SchoolDatabase/Models/Payment.cs
Normal file
55
School/SchoolDatabase/Models/Payment.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Payment : IPaymentModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required, Column(TypeName = "date")]
|
||||
public DateTime DatePayment { get; private set; } = DateTime.Now;
|
||||
[Required, Column(TypeName = "decimal (10,2)")]
|
||||
public decimal Sum { get; private set; }
|
||||
[Required]
|
||||
public int CoursesForStudyId { get; private set; }
|
||||
public virtual CoursesForStudy CoursesForStudy { get; set; } = new();
|
||||
public static Payment? Create(SchoolDbContext context, PaymentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
DatePayment = model.DatePayment,
|
||||
Sum = model.Sum,
|
||||
CoursesForStudy = context.CoursessForStudys.First(x => x.Id == model.CoursesForStudyId)
|
||||
};
|
||||
}
|
||||
public void Update(SchoolDbContext context, PaymentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DatePayment = model.DatePayment;
|
||||
Sum = model.Sum;
|
||||
CoursesForStudy = context.CoursessForStudys.First(x => x.Id == model.CoursesForStudyId);
|
||||
}
|
||||
public PaymentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
DatePayment = DatePayment,
|
||||
Sum = Sum,
|
||||
CoursesForStudyId = CoursesForStudyId
|
||||
};
|
||||
}
|
||||
}
|
64
School/SchoolDatabase/Models/Study.cs
Normal file
64
School/SchoolDatabase/Models/Study.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Study : IStudyModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required, Column(TypeName = "date")]
|
||||
public DateTime DateCreated { get; private set; } = DateTime.Now;
|
||||
[Required, Column(TypeName = "date")]
|
||||
public DateTime DateСompletion { get; private set; } = DateTime.Now;
|
||||
[Required]
|
||||
public int CustumerId { get; private set; }
|
||||
|
||||
// Курсы в обучении
|
||||
[ForeignKey("StudyId")]
|
||||
public virtual List<CoursesForStudy> CoursessForStudy { get; set; } = new();
|
||||
|
||||
// Затраты на обучение
|
||||
[ForeignKey("StudyId")]
|
||||
public virtual List<ItemForStudy> ItemsForStudy { get; set; } = new();
|
||||
public virtual Custumer Custumer { get; set; } = new();
|
||||
public static Study? Create(SchoolDbContext context, StudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
DateCreated = model.DateCreated,
|
||||
DateСompletion = model.DateСompletion,
|
||||
Custumer = context.Custumers.First(x => x.Id == model.CustumerId)
|
||||
};
|
||||
}
|
||||
public void Update(SchoolDbContext context, StudyBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DateCreated = model.DateCreated;
|
||||
DateСompletion = model.DateСompletion;
|
||||
Custumer = context.Custumers.First(x => x.Id == model.CustumerId);
|
||||
}
|
||||
public StudyViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
DateCreated = DateCreated,
|
||||
DateСompletion = DateСompletion,
|
||||
CustumerId = CustumerId,
|
||||
CustumerFIO = Custumer.FIO
|
||||
};
|
||||
}
|
||||
}
|
72
School/SchoolDatabase/Models/Worker.cs
Normal file
72
School/SchoolDatabase/Models/Worker.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.Models;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase.Models
|
||||
{
|
||||
public class Worker : IWorkerModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string Login { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Email { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string FIO { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Post { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Password { get; private set; } = string.Empty;
|
||||
|
||||
// Работы
|
||||
[ForeignKey("WorkerId")]
|
||||
public virtual List<Courses> Courses { get; set; } = new();
|
||||
|
||||
// Статьи затрат
|
||||
[ForeignKey("WorkerId")]
|
||||
public virtual List<Item> Items { get; set; } = new();
|
||||
public static Worker? Create(WorkerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Login = model.Login,
|
||||
Email = model.Email,
|
||||
FIO = model.FIO,
|
||||
Post = model.Post,
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public void Update(WorkerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
Email = model.Email;
|
||||
FIO = model.FIO;
|
||||
Post = model.Post;
|
||||
Password = model.Password;
|
||||
}
|
||||
public WorkerViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
Email = Email,
|
||||
FIO = FIO,
|
||||
Post = Post,
|
||||
Password = Password
|
||||
};
|
||||
}
|
||||
}
|
26
School/SchoolDatabase/SchoolDatabase.csproj
Normal file
26
School/SchoolDatabase/SchoolDatabase.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SchoolContracts\SchoolContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
38
School/SchoolDatabase/SchoolDbContext.cs
Normal file
38
School/SchoolDatabase/SchoolDbContext.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SchoolDatabase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDatabase
|
||||
{
|
||||
public class SchoolDbContext : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer
|
||||
(
|
||||
@"Data Source=localhost\SQLEXPRESS;
|
||||
Initial Catalog=SchoolDataBase1;
|
||||
Integrated Security=True;
|
||||
MultipleActiveResultSets=True;
|
||||
TrustServerCertificate=True"
|
||||
);
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Custumer> Custumers { get; set; }
|
||||
public virtual DbSet<Item> Items { get; set; }
|
||||
public virtual DbSet<ItemForStudy> ItemForStudys { get; set; }
|
||||
public virtual DbSet<Study> Studys { get; set; }
|
||||
public virtual DbSet<Courses> Coursess { get; set; }
|
||||
public virtual DbSet<CoursesForStudy> CoursessForStudys { get; set; }
|
||||
public virtual DbSet<Worker> Workers { get; set; }
|
||||
public virtual DbSet<Payment> Payments { get; set; }
|
||||
}
|
||||
}
|
||||
|
32
School/SchoolWebApp/Controllers/HomeController.cs
Normal file
32
School/SchoolWebApp/Controllers/HomeController.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SchoolWebApp.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SchoolWebApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
9
School/SchoolWebApp/Models/ErrorViewModel.cs
Normal file
9
School/SchoolWebApp/Models/ErrorViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SchoolWebApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
27
School/SchoolWebApp/Program.cs
Normal file
27
School/SchoolWebApp/Program.cs
Normal file
@ -0,0 +1,27 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
38
School/SchoolWebApp/Properties/launchSettings.json
Normal file
38
School/SchoolWebApp/Properties/launchSettings.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:6652",
|
||||
"sslPort": 44377
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5262",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7084;http://localhost:5262",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
School/SchoolWebApp/SchoolWebApp.csproj
Normal file
9
School/SchoolWebApp/SchoolWebApp.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
8
School/SchoolWebApp/Views/Home/Index.cshtml
Normal file
8
School/SchoolWebApp/Views/Home/Index.cshtml
Normal file
@ -0,0 +1,8 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
6
School/SchoolWebApp/Views/Home/Privacy.cshtml
Normal file
6
School/SchoolWebApp/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
25
School/SchoolWebApp/Views/Shared/Error.cshtml
Normal file
25
School/SchoolWebApp/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
49
School/SchoolWebApp/Views/Shared/_Layout.cshtml
Normal file
49
School/SchoolWebApp/Views/Shared/_Layout.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - SchoolWebApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/SchoolWebApp.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">SchoolWebApp</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - SchoolWebApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
48
School/SchoolWebApp/Views/Shared/_Layout.cshtml.css
Normal file
48
School/SchoolWebApp/Views/Shared/_Layout.cshtml.css
Normal file
@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
3
School/SchoolWebApp/Views/_ViewImports.cshtml
Normal file
3
School/SchoolWebApp/Views/_ViewImports.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@using SchoolWebApp
|
||||
@using SchoolWebApp.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
3
School/SchoolWebApp/Views/_ViewStart.cshtml
Normal file
3
School/SchoolWebApp/Views/_ViewStart.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
8
School/SchoolWebApp/appsettings.Development.json
Normal file
8
School/SchoolWebApp/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
School/SchoolWebApp/appsettings.json
Normal file
9
School/SchoolWebApp/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
22
School/SchoolWebApp/wwwroot/css/site.css
Normal file
22
School/SchoolWebApp/wwwroot/css/site.css
Normal file
@ -0,0 +1,22 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
BIN
School/SchoolWebApp/wwwroot/favicon.ico
Normal file
BIN
School/SchoolWebApp/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
4
School/SchoolWebApp/wwwroot/js/site.js
Normal file
4
School/SchoolWebApp/wwwroot/js/site.js
Normal file
@ -0,0 +1,4 @@
|
||||
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
22
School/SchoolWebApp/wwwroot/lib/bootstrap/LICENSE
Normal file
22
School/SchoolWebApp/wwwroot/lib/bootstrap/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2021 Twitter, Inc.
|
||||
Copyright (c) 2011-2021 The Bootstrap Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
4997
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
4997
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
1
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
7
School/SchoolWebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user