Compare commits
No commits in common. "d36d38e35310436d4c6771e2a34cb3ac220e189c" and "92cfe7ad61ffb27c55d4fe29e808cb500e2118ac" have entirely different histories.
d36d38e353
...
92cfe7ad61
@ -13,6 +13,8 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Student)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -20,6 +22,8 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Student)
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id)
|
||||
)
|
||||
@ -35,6 +39,8 @@ namespace UniversityDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Student)
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
public StatementViewModel? Insert(StatementBindingModel model)
|
||||
|
@ -15,8 +15,6 @@ namespace UniversityDatabaseImplement.Implements
|
||||
return context.Students
|
||||
.Include(x => x.StudentExaminationResults)
|
||||
.ThenInclude(x => x.ExaminationResult)
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Statement)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -26,8 +24,6 @@ namespace UniversityDatabaseImplement.Implements
|
||||
return context.Students
|
||||
.Include(x => x.StudentExaminationResults)
|
||||
.ThenInclude(x => x.ExaminationResult)
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Statement)
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(string.IsNullOrEmpty(model.Name) || x.Name.Contains(model.Name))
|
||||
@ -46,8 +42,6 @@ namespace UniversityDatabaseImplement.Implements
|
||||
return context.Students
|
||||
.Include(x => x.StudentExaminationResults)
|
||||
.ThenInclude(x => x.ExaminationResult)
|
||||
.Include(x => x.StatementStudents)
|
||||
.ThenInclude(x => x.Statement)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name== model.Name) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
@ -17,6 +17,20 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StatementId")]
|
||||
public virtual List<ExaminationResult> ExaminationResults { get; set; } = new();
|
||||
private Dictionary<int, IStudentModel>? _students = null;
|
||||
public Dictionary<int, IStudentModel> Students
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_students == null)
|
||||
{
|
||||
_students = StatementStudents.ToDictionary(
|
||||
x => x.Student.Id, x => x.Student as IStudentModel);
|
||||
}
|
||||
|
||||
return _students;
|
||||
}
|
||||
}
|
||||
public static Statement Create(StatementBindingModel model)
|
||||
{
|
||||
return new Statement
|
||||
@ -40,6 +54,7 @@ namespace UniversityDatabaseImplement.Models
|
||||
Id = Id,
|
||||
Date = Date,
|
||||
HoursCount = HoursCount,
|
||||
Students = Students
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -31,22 +31,6 @@ namespace UniversityDatabaseImplement.Models
|
||||
return _results;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<int, IStatementModel>? _statements;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IStatementModel> Statements
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_statements == null)
|
||||
{
|
||||
_statements = StatementStudents.ToDictionary(
|
||||
x => x.Statement.Id, x => x.Statement as IStatementModel);
|
||||
}
|
||||
|
||||
return _statements;
|
||||
}
|
||||
}
|
||||
public static Student Create(StudentBindingModel model)
|
||||
{
|
||||
return new Student
|
||||
@ -70,8 +54,7 @@ namespace UniversityDatabaseImplement.Models
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
RecordCardNumber = RecordCardNumber,
|
||||
Results = Results,
|
||||
Statements = Statements
|
||||
Results = Results
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,5 @@ namespace UniversityContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Department { get; set; } = String.Empty;
|
||||
public int StatementId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class ReportBindingModel
|
||||
{
|
||||
public string? FileName { get; set; } = string.Empty;
|
||||
public DateTime? From { get; set; }
|
||||
public DateTime? To { get; set; }
|
||||
public List<StudentViewModel> Students { get; set; } = new();
|
||||
}
|
||||
}
|
@ -7,5 +7,6 @@ namespace UniversityContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; set; }
|
||||
public Dictionary<int, IStudentModel> Students { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,5 @@ namespace UniversityContracts.BindingModels
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string RecordCardNumber { get; set; } = String.Empty;
|
||||
public Dictionary<int, IExaminationResultModel> Results { get; set; } = new();
|
||||
public Dictionary<int, IStatementModel> Statements { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
public interface IReportLogic
|
||||
{
|
||||
List<ReportStudentDisciplineViewModel> GetStudentDiscipline(ReportBindingModel model);
|
||||
}
|
||||
}
|
@ -7,6 +7,5 @@ namespace UniversityContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Department { get; set; } = String.Empty;
|
||||
public int StatementId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ReportStudentDisciplineViewModel
|
||||
{
|
||||
public string StudentName { get; set; } = string.Empty;
|
||||
public List<string> Disciplines { get; set; } = new();
|
||||
}
|
||||
}
|
@ -7,5 +7,6 @@ namespace UniversityContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; set; }
|
||||
public Dictionary<int, IStudentModel> Students { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,5 @@ namespace UniversityContracts.ViewModels
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string RecordCardNumber { get; set; } = String.Empty;
|
||||
public Dictionary<int, IExaminationResultModel> Results { get; set; } = new();
|
||||
public Dictionary<int, IStatementModel> Statements { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
{
|
||||
String Name { get; }
|
||||
String Department { get; }
|
||||
int StatementId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,6 @@
|
||||
{
|
||||
DateTime Date { get; }
|
||||
int HoursCount { get; }
|
||||
Dictionary<int, IStudentModel> Students { get; }
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,5 @@
|
||||
String Name { get; }
|
||||
String RecordCardNumber { get; }
|
||||
Dictionary<int, IExaminationResultModel> Results { get; }
|
||||
Dictionary<int, IStatementModel> Statements { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user