Merge branch 'cccc' into provider
This commit is contained in:
commit
1813adc543
@ -8,7 +8,7 @@ using UniversityModels.Models;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class StreamViewModel
|
||||
public class StreamViewModel : IStreamModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
@ -16,7 +16,7 @@ namespace UniversityContracts.ViewModels
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Номер курса")]
|
||||
public int Course { get; set; }
|
||||
public List<StudentViewModel> StudentStream = new();
|
||||
public List<EducationGroupViewModel> StreamEdGroups = new();
|
||||
public List<StudentViewModel> StudentStream { get; set; } = new();
|
||||
public List<EducationGroupViewModel> StreamEdGroups { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -33,19 +33,19 @@ namespace UniversityCustomer.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Document = APIClient.GetRequest<DocumentViewModel>($"api/discipline/get?id={id}");
|
||||
ViewBag.Discipline = APIClient.GetRequest<DisciplineViewModel>($"api/discipline/get?id={id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update([FromBody] DisciplineBindingModel streamModel)
|
||||
public void Update([FromBody] DisciplineBindingModel disciplineModel)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
streamModel.UserId = APIClient.User.Id;
|
||||
APIClient.PostRequest("api/discipline/update", streamModel);
|
||||
disciplineModel.UserId = APIClient.User.Id;
|
||||
APIClient.PostRequest("api/discipline/update", disciplineModel);
|
||||
Response.Redirect("/Home/Disciplines");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityModels.Models;
|
||||
|
||||
namespace UniversityCustomer.Controllers
|
||||
{
|
||||
@ -33,20 +34,20 @@ namespace UniversityCustomer.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Student = APIClient.GetRequest<StudentViewModel>($"api/student/get?id={id}");
|
||||
ViewBag.EducationGroup = APIClient.GetRequest<EducationGroupViewModel>($"api/educationgroup/get?id={id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update([FromBody] StudentBindingModel studentModel)
|
||||
public void Update([FromBody] EducationGroupBindingModel egsModel)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
studentModel.UserId = APIClient.User.Id;
|
||||
APIClient.PostRequest("api/student/update", studentModel);
|
||||
Response.Redirect("/Home/Students");
|
||||
egsModel.UserId = APIClient.User.Id;
|
||||
APIClient.PostRequest("api/educationgroup/update", egsModel);
|
||||
Response.Redirect("/Home/EducationGroups");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -56,38 +57,28 @@ namespace UniversityCustomer.Controllers
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest($"api/student/delete", new StudentBindingModel() { Id = id });
|
||||
Response.Redirect("/Home/Students");
|
||||
APIClient.PostRequest($"api/educationgroup/delete", new EducationGroupBindingModel() { Id = id });
|
||||
Response.Redirect("/Home/EducationGroups");
|
||||
}
|
||||
|
||||
public List<StudentViewModel> GetAllByUser()
|
||||
public List<EducationGroupViewModel> GetAllByUser()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<StudentViewModel>? students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getallbyuser?userId={APIClient.User.Id}");
|
||||
return students ?? new();
|
||||
List<EducationGroupViewModel>? egs = APIClient.GetRequest<List<EducationGroupViewModel>>($"api/educationgroup/getallbyuser?userId={APIClient.User.Id}");
|
||||
return egs ?? new();
|
||||
}
|
||||
|
||||
public List<StudentViewModel> GetAllByUserAndEducationStatus(int educationstatus)
|
||||
public EducationGroupViewModel? Get(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return new();
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<StudentViewModel>? students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getallbyuserandeducationstatus?userId={APIClient.User.Id}&educationstatus={educationstatus}");
|
||||
return students ?? new();
|
||||
}
|
||||
|
||||
public StudentViewModel? Get(int id)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
StudentViewModel? student = APIClient.GetRequest<StudentViewModel>($"api/student/get?id={id}");
|
||||
return student;
|
||||
EducationGroupViewModel? eg = APIClient.GetRequest<EducationGroupViewModel>($"api/educationgroup/get?id={id}");
|
||||
return eg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace UniversityCustomer.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Document = APIClient.GetRequest<DocumentViewModel>($"api/stream/get?id={id}");
|
||||
ViewBag.Stream = APIClient.GetRequest<StreamViewModel>($"api/stream/get?id={id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
|
49
UniversityCustomer/Views/Discipline/Update.cshtml
Normal file
49
UniversityCustomer/Views/Discipline/Update.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
@using UniversityContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Дисциплина";
|
||||
}
|
||||
|
||||
@{
|
||||
|
||||
<h4 id="discipline-data" class="fw-bold" data-id="@ViewBag.Discipline.Id">Обновление приказа</h4>
|
||||
|
||||
if (ViewBag.Discipline == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите в аккаунт</h3>
|
||||
return;
|
||||
}
|
||||
<div id="error-div-shell" class="error-div-shell mb-2">
|
||||
<div>
|
||||
<p id="error-p" class="error-p"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mb-0">Имя:</p>
|
||||
<input value="@ViewBag.Discipline.Name" type="text" id="name-input" name="name" class="form-control mb-3" />
|
||||
<p class="mb-0">Часы:</p>
|
||||
<input value="@ViewBag.Discipline.Hours" type="text" id="hours-input" name="hours" class="form-control mb-3" />
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label for="markTypeSelect">Тип отметки:</label>
|
||||
<select id="markTypeSelect">
|
||||
<option value="false">Зачёт</option>
|
||||
<option value="true">Экзамен</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label for="streamsSelect">Потоки:</label>
|
||||
<select id="streamsSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<button id="update-button" type="button" class="button-primary text-button">
|
||||
Сохранить изменения
|
||||
</button>
|
||||
}
|
||||
|
||||
<script src="~/js/discipline/disciplines-update.js" asp-append-version="true"></script>
|
@ -1 +1,36 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Поток";
|
||||
}
|
||||
|
||||
@{
|
||||
<h4 id="stream-data" class="fw-bold" data-id="@ViewBag.Stream.Id">Обновление потока</h4>
|
||||
|
||||
<div id="error-div-shell" class="error-div-shell mb-2">
|
||||
<div>
|
||||
<p id="error-p" class="error-p"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mb-0">Название:</p>
|
||||
<input type="text" value="@ViewBag.Stream.Name" id="name-input" name="name" class="form-control mb-3" />
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Сохранить изменения
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<div class="scrollable-table">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Количество студентов</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<script src="~/js/stream/stream-update.js" asp-append-version="true"></script>
|
120
UniversityCustomer/wwwroot/js/discipline/disciplines-update.js
Normal file
120
UniversityCustomer/wwwroot/js/discipline/disciplines-update.js
Normal file
@ -0,0 +1,120 @@
|
||||
const createBtn = document.getElementById("update-button");
|
||||
const tbody = document.getElementById("scrollable-table__tbody");
|
||||
const currentDisciplineId = document.getElementById("discipline-data").dataset.id;
|
||||
|
||||
const nameInput = document.getElementById("name-input");
|
||||
const hoursInput = document.getElementById("hours-input");
|
||||
const select = document.getElementById("streamsSelect");
|
||||
const markTypeSelect = document.getElementById("markTypeSelect");
|
||||
var streams = [];
|
||||
var dataArray = [];
|
||||
var currentDiscipline = null;
|
||||
var currentStream = null;
|
||||
|
||||
const correctData = () => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const validate = () => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: `/discipline/get?id=${currentDisciplineId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
currentDiscipline = result;
|
||||
});
|
||||
const streamsResponse = await $.ajax({
|
||||
url: `/stream/getallbyuser`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
});
|
||||
streams = streamsResponse;
|
||||
|
||||
if (currentDiscipline.markType) {
|
||||
markTypeSelect.selectedIndex = 1;
|
||||
}
|
||||
else
|
||||
markTypeSelect.selectedIndex = 0;
|
||||
|
||||
streams.forEach((stream) => {
|
||||
createStreamOption(stream);
|
||||
});
|
||||
select.selectedIndex = currentDiscipline.StreamId - 1;
|
||||
|
||||
})
|
||||
|
||||
const createStreamOption = (stream) => {
|
||||
const option = document.createElement("option");
|
||||
option.value = stream.id;
|
||||
option.innerHTML = stream.name;
|
||||
select.appendChild(option);
|
||||
select.selectedIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
createBtn.addEventListener('click',() => {
|
||||
if (!correctData()) {
|
||||
return;
|
||||
}
|
||||
if (!validate()) {
|
||||
return;
|
||||
}
|
||||
const stream = streams.find(x => x.id === parseInt(select.value));
|
||||
var markType = true;
|
||||
if (markTypeSelect.value === "false") {
|
||||
markType = false
|
||||
}
|
||||
var disciplinetUpdate = {
|
||||
"Id": currentDiscipline.id,
|
||||
"Name": nameInput.value,
|
||||
"Hours": hoursInput.value,
|
||||
"Marktype": markType,
|
||||
"StreamId": stream.id
|
||||
}
|
||||
$.ajax({
|
||||
url: "/discipline/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(disciplinetUpdate)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Disciplines";
|
||||
});
|
||||
})
|
||||
|
||||
const createRowForStudentsTable = (student) => {
|
||||
const { id, name, surname, dateOfBirth, studentCard, educationStatusName } = student;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [name, surname, formatDate(dateOfBirth), studentCard, educationStatusName];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
if (currentDiscipline.documentStudents.find(x => parseInt(x.id) === parseInt(student.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(student);
|
||||
}
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
};
|
||||
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
var index = dataArray.indexOf(students.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(students.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
row.classList.remove("bg-success");
|
||||
}
|
||||
}
|
@ -21,5 +21,5 @@ removeButtons.forEach(function (button) {
|
||||
|
||||
pageInput.addEventListener("input", () => {
|
||||
const pageNumber = parseInt(pageInput.value);
|
||||
goToPageBtn.href = `/Home/Students?page=${pageNumber}`;
|
||||
goToPageBtn.href = `/Home/EducationGroup?page=${pageNumber}`;
|
||||
});
|
||||
|
@ -1 +1,91 @@
|
||||
|
||||
const createBtn = document.getElementById("create-button");
|
||||
const tbody = document.getElementById("scrollable-table__tbody");
|
||||
const nameInput = document.getElementById("name-input");
|
||||
const currentStreamId = document.getElementById("stream-data").dataset.id;
|
||||
var groups = [];
|
||||
var dataArray = [];
|
||||
var currentStream = null;
|
||||
|
||||
const correctData = () => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const validate = () => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: "/educationgroup/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
groups = result;
|
||||
});
|
||||
await $.ajax({
|
||||
url: `/stream/get?id=${currentStreamId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
currentStream = result;
|
||||
});
|
||||
groups.forEach((group) => createRowForGroupTable(group));
|
||||
})
|
||||
|
||||
createBtn.addEventListener('click', () => {
|
||||
if (!correctData()) {
|
||||
return;
|
||||
}
|
||||
if (!validate()) {
|
||||
return;
|
||||
}
|
||||
var streamGroupsUpdate = {
|
||||
"Id": currentStream.id,
|
||||
"Name": nameInput.value,
|
||||
"EducationGroupStream": dataArray,
|
||||
"StreamStudents": currentStream.StreamStudents,
|
||||
}
|
||||
$.ajax({
|
||||
url: "/stream/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(streamGroupsUpdate)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Streams";
|
||||
});
|
||||
})
|
||||
|
||||
const createRowForGroupTable = (group) => {
|
||||
const { id, name, numberOfStudents } = group;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [name, numberOfStudents];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
if (currentStream.StreamEdGroups.find(x => parseInt(x.id) === parseInt(groups.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(student);
|
||||
}
|
||||
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
};
|
||||
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
var index = dataArray.indexOf(groups.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(groups.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
row.classList.remove("bg-success");
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace UniversityDataBaseImplemet
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=UniversityCourseWork;Username=postgres;Password=123");
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=UniversityCourseWork;Username=postgres;Password=0000");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -93,6 +94,8 @@ namespace UniversityDataBaseImplemet.Implements
|
||||
{
|
||||
using var context = new Database();
|
||||
var stream = context.Discipline
|
||||
.Include(record => record.User)
|
||||
.Include(record => record.Stream)
|
||||
.FirstOrDefault(record => record.Id.Equals(model.Id));
|
||||
if (stream == null)
|
||||
{
|
||||
|
@ -106,8 +106,8 @@ namespace UniversityDataBaseImplemet.Implements
|
||||
{
|
||||
using var context = new Database();
|
||||
var stream = context.Streams
|
||||
.Include(record => record.User)
|
||||
.Include(record => record.StreamStudents)
|
||||
.Include(record => record.User)
|
||||
.Include(record => record.EducationGroupStream)
|
||||
.FirstOrDefault(record => record.Id.Equals(model.Id));
|
||||
if (stream == null)
|
||||
{
|
||||
|
525
UniversityDataBaseImplemet/Migrations/20230520013404_ccc.Designer.cs
generated
Normal file
525
UniversityDataBaseImplemet/Migrations/20230520013404_ccc.Designer.cs
generated
Normal file
@ -0,0 +1,525 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using UniversityDataBaseImplemet;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDataBaseImplemet.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20230520013404_ccc")]
|
||||
partial class ccc
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("NumberOfStudent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.ToTable("EducationGroupViewModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Hours")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("MarkType")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Discipline");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Documents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("NumberOfStudent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EducationGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("EducationGroupId", "DocumentId");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.ToTable("EducationGroupsDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("EducationGroupId", "StreamId");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.ToTable("EducationGroupsStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EducationStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Course")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Streams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateOfAddmission")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateOfBirth")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("EducationStatusId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentCard")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EducationStatusId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("StudentId", "DocumentId");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.ToTable("StudentDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("StudentId", "StreamId");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.ToTable("StudentStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", null)
|
||||
.WithMany("StreamEdGroups")
|
||||
.HasForeignKey("StreamId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany()
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("Documents")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("EducationGroups")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
|
||||
b.Navigation("Stream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("EducationStatuses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("Streams")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("EducationStatusId");
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationStatus");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("DocumentStudents")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("StreamStudents")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("StudentStream")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("EducationGroupStream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupStream");
|
||||
|
||||
b.Navigation("StreamEdGroups");
|
||||
|
||||
b.Navigation("StreamStudents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Navigation("DocumentStudents");
|
||||
|
||||
b.Navigation("StudentStream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Disciplines");
|
||||
|
||||
b.Navigation("Documents");
|
||||
|
||||
b.Navigation("EducationGroups");
|
||||
|
||||
b.Navigation("EducationStatuses");
|
||||
|
||||
b.Navigation("Streams");
|
||||
|
||||
b.Navigation("Students");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
22
UniversityDataBaseImplemet/Migrations/20230520013404_ccc.cs
Normal file
22
UniversityDataBaseImplemet/Migrations/20230520013404_ccc.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDataBaseImplemet.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ccc : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -114,14 +114,14 @@ namespace UniversityDataBaseImplemet.Models
|
||||
}
|
||||
_educationGroupStream = null;
|
||||
}
|
||||
public StreamViewModel GetViewModel => new()
|
||||
public StreamViewModel GetViewModel => new StreamViewModel()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
UserId = UserId,
|
||||
Course= Course,
|
||||
StudentStream = StudentStream,
|
||||
StreamEdGroups = StreamEdGroups,
|
||||
StreamEdGroups = StreamEdGroups
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user