Compare commits
2 Commits
097918078f
...
1295f4c633
Author | SHA1 | Date | |
---|---|---|---|
|
1295f4c633 | ||
|
0d6cafab67 |
@ -86,6 +86,7 @@ public class ReportLogic : IReportLogic
|
||||
// Добавляем учителя и его студентов в результат
|
||||
result.Add(new ReportTeacherViewModel
|
||||
{
|
||||
TeacherId = teacher.Id,
|
||||
TeacherName = teacher.Name,
|
||||
Students = students.Distinct().ToList() // Убираем дубликаты, если они есть
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user