Compare commits

..

2 Commits

Author SHA1 Message Date
GokaPek
1295f4c633 Merge branch 'main' of https://git.is.ulstu.ru/StroevVladimir/CourseWork 2024-05-28 22:09:53 +04:00
GokaPek
0d6cafab67 Частично готово Егор Ворд 2024-05-28 22:09:51 +04:00
3 changed files with 21 additions and 2 deletions

View File

@ -86,6 +86,7 @@ public class ReportLogic : IReportLogic
// Добавляем учителя и его студентов в результат
result.Add(new ReportTeacherViewModel
{
TeacherId = teacher.Id,
TeacherName = teacher.Name,
Students = students.Distinct().ToList() // Убираем дубликаты, если они есть
});

View File

@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false)
{
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR
optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-N8BRIPR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using University.ViewModels;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.BusinessLogicsContracts;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
@ -12,10 +14,12 @@ namespace UniversityRestApi.Controllers
{
private readonly ILogger _logger;
private readonly ITeacherLogic _logic;
public TeacherController(ITeacherLogic logic, ILogger<TeacherController> logger)
private readonly IReportLogic _reportLogic;
public TeacherController(ITeacherLogic logic, ILogger<TeacherController> logger, IReportLogic reportLogic)
{
_logic = logic;
_logger = logger;
_reportLogic = reportLogic;
}
[HttpGet]
public List<TeacherViewModel>? GetTeachers(int userId)
@ -82,5 +86,19 @@ namespace UniversityRestApi.Controllers
throw;
}
}
[HttpGet]
public List<ReportTeacherViewModel>? GetDisciplinesReport()
{
try
{
return _reportLogic.GetTeachers();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка планов обучения");
throw;
}
}
}
}