Небольшие правки

This commit is contained in:
Володя 2023-04-06 18:54:34 +03:00
parent 60e99edc70
commit 80813a1753
6 changed files with 12 additions and 2 deletions

View File

@ -10,6 +10,8 @@ namespace SchoolAgainStudyContracts.ViewModel
{ {
public int Id { get; set; } public int Id { get; set; }
public string TitleLesson { get; set; } = string.Empty; public string TitleLesson { get; set; } = string.Empty;
public DateTime DateEventLesson { get; set; }
public string TitleTask { get; set; } = string.Empty; public string TitleTask { get; set; } = string.Empty;
public DateTime DateIssueTask { get; set; }
} }
} }

View File

@ -20,6 +20,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Diys return context.Diys
.Include(x => x.Interests) .Include(x => x.Interests)
.ThenInclude(x => x.Interest) .ThenInclude(x => x.Interest)
.Include(x => x.Task)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
@ -38,6 +39,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Diys return context.Diys
.Include(x => x.Interests) .Include(x => x.Interests)
.ThenInclude(x => x.Interest) .ThenInclude(x => x.Interest)
.Include(x => x.Task)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.StudentId == model.StudentId) .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.StudentId == model.StudentId)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -47,6 +49,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Diys return context.Diys
.Include(x => x.Interests) .Include(x => x.Interests)
.ThenInclude(x => x.Interest) .ThenInclude(x => x.Interest)
.Include(x => x.Task)
.Where(x => x.StudentId == model.StudentId ) .Where(x => x.StudentId == model.StudentId )
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -65,6 +68,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Diys return context.Diys
.Include(x => x.Interests) .Include(x => x.Interests)
.ThenInclude(x => x.Interest) .ThenInclude(x => x.Interest)
.Include(x => x.Task)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) ||
(model.Id.HasValue && x.Id == model.Id)) (model.Id.HasValue && x.Id == model.Id))
?.GetViewModel; ?.GetViewModel;

View File

@ -20,6 +20,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Lessons return context.Lessons
.Include(x => x.Materials) .Include(x => x.Materials)
.ThenInclude(x => x.Material) .ThenInclude(x => x.Material)
.Include(x => x.Product)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
@ -37,6 +38,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Lessons return context.Lessons
.Include(x => x.Materials) .Include(x => x.Materials)
.ThenInclude(x => x.Material) .ThenInclude(x => x.Material)
.Include(x => x.Product)
.Where(x => x.DateEvent >= model.DateFrom && x.DateEvent <= model.DateTo && x.TeacherId == model.TeacherId) .Where(x => x.DateEvent >= model.DateFrom && x.DateEvent <= model.DateTo && x.TeacherId == model.TeacherId)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -45,6 +47,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Lessons return context.Lessons
.Include(x => x.Materials) .Include(x => x.Materials)
.ThenInclude(x => x.Material) .ThenInclude(x => x.Material)
.Include(x => x.Product)
.Where(x => x.TeacherId == model.TeacherId) .Where(x => x.TeacherId == model.TeacherId)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -61,6 +64,7 @@ namespace SchoolAgainStudyDataBaseImplements.Implements
return context.Lessons return context.Lessons
.Include(x => x.Materials) .Include(x => x.Materials)
.ThenInclude(x => x.Material) .ThenInclude(x => x.Material)
.Include(x => x.Product)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) ||
(model.Id.HasValue && x.Id == model.Id)) (model.Id.HasValue && x.Id == model.Id))
?.GetViewModel; ?.GetViewModel;

View File

@ -12,7 +12,7 @@ using SchoolAgainStudyDataBaseImplements;
namespace SchoolAgainStudyDataBaseImplements.Migrations namespace SchoolAgainStudyDataBaseImplements.Migrations
{ {
[DbContext(typeof(SchoolDataBase))] [DbContext(typeof(SchoolDataBase))]
[Migration("20230405182217_Initial")] [Migration("20230406155014_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />

View File

@ -10,7 +10,7 @@ namespace SchoolAgainStudyDataModels.Models
{ {
string Title { get; } string Title { get; }
string Description { get; } string Description { get; }
string? TaskName { get; } string TaskName { get; }
DateTime DateCreate { get; } DateTime DateCreate { get; }
int TaskId { get; } int TaskId { get; }
int StudentId { get; } int StudentId { get; }