This commit is contained in:
Danil Markov 2023-04-08 23:59:00 +04:00
parent 99b3c179e7
commit c56480c354
6 changed files with 111 additions and 20 deletions

View File

@ -45,16 +45,15 @@ namespace UniversityBusinessLogic.BusinessLogics
_saveToPdf = saveToPdf;
}
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(ReportBindingModel model)
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(List<StudentViewModel> 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();

View File

@ -10,7 +10,7 @@ namespace UniversityContracts.BusinessLogicContracts
{
public interface IReportProviderLogic
{
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(ReportBindingModel model);
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(List<StudentViewModel> students, ReportBindingModel model);
List<ReportStreamStudentEdStatPeriodViewModel> StreamStudentEdStatPeriod(ReportBindingModel model);

View File

@ -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();
}

View File

@ -1,5 +1,21 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Login";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Войти" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -1,5 +1,21 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
@{
ViewData["Title"] = "Register";
}
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -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<StudentViewModel>
@model List<EducationStatusViewModel>
@{
ViewData["Title"] = "Студенты";
}
<div class="text-center">
<h1 class="display-4">Студенты</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Войдите в аккаунт</h3>
return;
}
<div>
<a class="btn btn-secondary" asp-action="Student">Добавить</a>
<a class="btn btn-secondary" asp-action="Student">Изменить</a>
<a class="btn btn-secondary" asp-action="Student">Удалить</a>
<a class="btn btn-secondary" asp-action="Student">Обновить</a>
</div>
<table class="table">
<thead>
<tr>
<th>
Имя Фамилия
</th>
<th>
Дата Рождения
</th>
<th>
Номер Студ.билета
</th>
<th>
Статус обучения
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name + ' ' + item.Surname)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateOfBirth)
</td>
<td>
@Html.DisplayFor(modelItem => item.StudentCard)
</td>
<td>
@Html.DisplayFor(modelItem => item.EducationStatusId)
</td>
</tr>
}
</tbody>
</table>
}
</div>