Пофиксил баг с дисциплинами
This commit is contained in:
parent
520441bd07
commit
5e53d3c1d5
@ -90,7 +90,7 @@ namespace UniversityClientApp.Controllers
|
||||
ViewBag.Students = APIStorekeeper.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIStorekeeper.Client.Id}");
|
||||
|
||||
// Îæèäàåì çàâåðøåíèÿ àñèíõðîííîé îïåðàöèè
|
||||
var disciplines = await APIStorekeeper.GetRequestDisciplineAsync<List<DisciplineViewModel>>($"api/discipline/getdisciplines?teacherId={0}");
|
||||
var disciplines = await APIStorekeeper.GetRequestDisciplineAsync<List<DisciplineViewModel>>($"api/discipline/getdisciplines");
|
||||
|
||||
// Òåïåðü ìû ìîæåì ïåðåäàòü ðåçóëüòàò â ïðåäñòàâëåíèå
|
||||
return View(disciplines);
|
||||
@ -111,7 +111,6 @@ namespace UniversityClientApp.Controllers
|
||||
Date = date,
|
||||
TeacherId = teacher,
|
||||
StudentDisciplines = studentIds.ToDictionary(id => id, id => (IStudentModel)null)
|
||||
// íå ïðàâèëüíî
|
||||
};
|
||||
|
||||
APIStorekeeper.PostRequest("api/discipline/creatediscipline", disciplineModel);
|
||||
|
@ -96,10 +96,10 @@ namespace UniversityDatabaseImplement.Implements
|
||||
|
||||
|
||||
|
||||
/*if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
query = query.Where(x => model.DateFrom.Value <= x.Date && x.Date <= model.DateTo.Value);
|
||||
}*/
|
||||
|
||||
|
||||
var x = query.Select(x => x.GetViewModel).ToList();
|
||||
var res = new List<DisciplineViewModel>();
|
||||
@ -110,9 +110,9 @@ namespace UniversityDatabaseImplement.Implements
|
||||
res.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//return query.Select(x => x.GetViewModel).ToList();
|
||||
return res;
|
||||
}
|
||||
return query.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,8 @@ namespace UniversityDatabaseImplement.Implements
|
||||
return context.Disciplines
|
||||
.Include(x => x.Students)
|
||||
.ThenInclude(x => x.Student)
|
||||
.ToList()
|
||||
.Include(x => x.Teacher)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.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=LAPTOP-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);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace UniversityRestApi.Controllers
|
||||
_reportLogic = reportLogic;
|
||||
_mailWorker = mailWorker;
|
||||
}
|
||||
[HttpGet]
|
||||
/*[HttpGet]
|
||||
public List<DisciplineViewModel>? GetDisciplines(int userId)
|
||||
{
|
||||
try
|
||||
@ -35,8 +35,21 @@ namespace UniversityRestApi.Controllers
|
||||
_logger.LogError(ex, "Ошибка получения списка дисциплин");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
}*/
|
||||
[HttpGet]
|
||||
public List<DisciplineViewModel>? GetDisciplines()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка дисциплин");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ReportDisciplineViewModel> GetReportDisciplines(DateOnly dateFrom, DateOnly dateTo)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user