From c56480c3545b2cb6d8d59f36f28e64fb8d56068b Mon Sep 17 00:00:00 2001 From: Danil Markov Date: Sat, 8 Apr 2023 23:59:00 +0400 Subject: [PATCH] fix --- .../BusinessLogics/ReportProviderLogic.cs | 12 ++-- .../IReportProviderLogic.cs | 2 +- .../Implements/DocumentStorage.cs | 3 +- UniversityProvider/Views/Home/Login.cshtml | 24 +++++-- .../Views/Home/Registration.cshtml | 24 +++++-- UniversityProvider/Views/Home/Students.cshtml | 66 ++++++++++++++++++- 6 files changed, 111 insertions(+), 20 deletions(-) diff --git a/UniversityBusinessLogic/BusinessLogics/ReportProviderLogic.cs b/UniversityBusinessLogic/BusinessLogics/ReportProviderLogic.cs index a768b16..dcd0899 100644 --- a/UniversityBusinessLogic/BusinessLogics/ReportProviderLogic.cs +++ b/UniversityBusinessLogic/BusinessLogics/ReportProviderLogic.cs @@ -45,16 +45,15 @@ namespace UniversityBusinessLogic.BusinessLogics _saveToPdf = saveToPdf; } - public List GetStudentsDiscipline(ReportBindingModel model) + public List GetStudentsDiscipline(List students) { - var result = _studentStorage - .GetFilteredList(new StudentSearchModel { UserId = model.UserId }) + var result = students .Select(student => new ReportStudentsDisciplineViewModel { StudentFIO = $"{student.Name} {student.Surname}", - Disciplines = _streamStorage.GetFilteredList(new StreamSearchModel { UserId = model.UserId }) + Disciplines = _streamStorage.GetFullList() .Where(stream => stream.StudentStream.ContainsKey(student.Id)) - .Join(_disciplineStorage.GetFilteredList(new DisciplineSearchModel { UserId = model.UserId }), + .Join(_disciplineStorage.GetFullList(), stream => stream.Id, discipline => discipline.StreamId, (stream, discipline) => discipline.Name) @@ -81,8 +80,7 @@ namespace UniversityBusinessLogic.BusinessLogics .Any(document => document.StudentDocument.ContainsKey(student.Value.Id)))//Выбираем студентов, которые есть в приказах за выбранный промежуток времени .Select(student => ( StudentFIO: $"{student.Value.Name} {student.Value.Surname}", - EdStatus: _educationStatusStorage.GetFilteredList(new EducationStatusSearchModel { UserId = model.UserId }) - .First(x => x.Id == student.Value.EducationStatusId).Name)) + EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = student.Value.EducationStatusId })?.Name ?? "не удалось получить")) .ToList() }) .ToList(); diff --git a/UniversityContracts/BusinessLogicContracts/IReportProviderLogic.cs b/UniversityContracts/BusinessLogicContracts/IReportProviderLogic.cs index 96131e2..99a17ff 100644 --- a/UniversityContracts/BusinessLogicContracts/IReportProviderLogic.cs +++ b/UniversityContracts/BusinessLogicContracts/IReportProviderLogic.cs @@ -10,7 +10,7 @@ namespace UniversityContracts.BusinessLogicContracts { public interface IReportProviderLogic { - List GetStudentsDiscipline(ReportBindingModel model); + List GetStudentsDiscipline(List students, ReportBindingModel model); List StreamStudentEdStatPeriod(ReportBindingModel model); diff --git a/UniversityDataBaseImplemet/Implements/DocumentStorage.cs b/UniversityDataBaseImplemet/Implements/DocumentStorage.cs index 274ac2a..a5a0379 100644 --- a/UniversityDataBaseImplemet/Implements/DocumentStorage.cs +++ b/UniversityDataBaseImplemet/Implements/DocumentStorage.cs @@ -79,7 +79,8 @@ namespace UniversityDataBaseImplemet.Implements using var context = new Database(); return context.Documents .Include(record => record.User) - + .Include(record => record.Students) + .ThenInclude(record => record.Student) .Select(record => record.GetViewModel) .ToList(); } diff --git a/UniversityProvider/Views/Home/Login.cshtml b/UniversityProvider/Views/Home/Login.cshtml index e1dd794..3e5c9a2 100644 --- a/UniversityProvider/Views/Home/Login.cshtml +++ b/UniversityProvider/Views/Home/Login.cshtml @@ -1,5 +1,21 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ +@{ + ViewData["Title"] = "Login"; } + +
+

Вход в приложение

+
+
+
+
Логин:
+
+
+
+
Пароль:
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/UniversityProvider/Views/Home/Registration.cshtml b/UniversityProvider/Views/Home/Registration.cshtml index e1dd794..2b000d6 100644 --- a/UniversityProvider/Views/Home/Registration.cshtml +++ b/UniversityProvider/Views/Home/Registration.cshtml @@ -1,5 +1,21 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ +@{ + ViewData["Title"] = "Register"; } + +
+

Регистрация

+
+
+
+
Логин:
+
+
+
+
Пароль:
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/UniversityProvider/Views/Home/Students.cshtml b/UniversityProvider/Views/Home/Students.cshtml index e1dd794..d80ff8f 100644 --- a/UniversityProvider/Views/Home/Students.cshtml +++ b/UniversityProvider/Views/Home/Students.cshtml @@ -1,5 +1,65 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@using UniversityContracts.ViewModels +@model List +@model List + @{ + ViewData["Title"] = "Студенты"; } + +
+

Студенты

+
+ + +
+ @{ + if (Model == null) + { +

Войдите в аккаунт

+ return; + } + + + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Имя Фамилия + + Дата Рождения + + Номер Студ.билета + + Статус обучения +
+ @Html.DisplayFor(modelItem => item.Name + ' ' + item.Surname) + + @Html.DisplayFor(modelItem => item.DateOfBirth) + + @Html.DisplayFor(modelItem => item.StudentCard) + + @Html.DisplayFor(modelItem => item.EducationStatusId) +
+ } +
\ No newline at end of file