Compare commits
10 Commits
41dc907c53
...
1503a5c132
Author | SHA1 | Date | |
---|---|---|---|
|
1503a5c132 | ||
|
4a787d1931 | ||
|
0e7052eb80 | ||
|
fb0fcd5c18 | ||
|
ebfba932d8 | ||
|
bbf2dae2f8 | ||
|
35732809a7 | ||
|
d6faa35d6d | ||
|
27b7fee2d8 | ||
|
1e7d4a3754 |
@ -8,5 +8,72 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ActivityStorage : IActivityStorage
|
||||
{
|
||||
public ActivityViewModel? Delete(ActivityBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.Activities.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Activities.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ActivityViewModel? GetElement(ActivitySearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Activities
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<ActivityViewModel> GetFilteredList(ActivitySearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Activities
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id)
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ActivityViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Activities.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ActivityViewModel? Insert(ActivityBindingModel model)
|
||||
{
|
||||
var newActivity = Activity.Create(model);
|
||||
if (newActivity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.Activities.Add(newActivity);
|
||||
context.SaveChanges();
|
||||
return newActivity.GetViewModel;
|
||||
}
|
||||
|
||||
public ActivityViewModel? Update(ActivityBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var activity = context.Activities.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (activity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
activity.Update(model);
|
||||
context.SaveChanges();
|
||||
return activity.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,74 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class DisciplineStorage : IDisciplineStorage
|
||||
{
|
||||
public DisciplineViewModel? Delete(DisciplineBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.Disciplines.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.ExaminationResults.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DisciplineViewModel? GetElement(DisciplineSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Disciplines
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name == model.Name) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<DisciplineViewModel> GetFilteredList(DisciplineSearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Disciplines
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(string.IsNullOrEmpty(model.Name) || x.Name.Contains(model.Name))
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<DisciplineViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Disciplines.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public DisciplineViewModel? Insert(DisciplineBindingModel model)
|
||||
{
|
||||
var newDiscipline = Discipline.Create(model);
|
||||
if (newDiscipline == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.Disciplines.Add(newDiscipline);
|
||||
context.SaveChanges();
|
||||
return newDiscipline.GetViewModel;
|
||||
}
|
||||
|
||||
public DisciplineViewModel? Update(DisciplineBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var discipline = context.Disciplines.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (discipline == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
discipline.Update(model);
|
||||
context.SaveChanges();
|
||||
return discipline.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,72 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ExaminationResultStorage : IExaminationResultStorage
|
||||
{
|
||||
public ExaminationResultViewModel? Delete(ExaminationResultBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.ExaminationResults.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.ExaminationResults.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ExaminationResultViewModel? GetElement(ExaminationResultSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ExaminationResults
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<ExaminationResultViewModel> GetFilteredList(ExaminationResultSearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ExaminationResults
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id)
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ExaminationResultViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ExaminationResults.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ExaminationResultViewModel? Insert(ExaminationResultBindingModel model)
|
||||
{
|
||||
var newExaminationResult = ExaminationResult.Create(model);
|
||||
if (newExaminationResult == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.ExaminationResults.Add(newExaminationResult);
|
||||
context.SaveChanges();
|
||||
return newExaminationResult.GetViewModel;
|
||||
}
|
||||
|
||||
public ExaminationResultViewModel? Update(ExaminationResultBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var examinationResult = context.ExaminationResults.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (examinationResult == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
examinationResult.Update(model);
|
||||
context.SaveChanges();
|
||||
return examinationResult.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,74 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ReportTypeStorage : IReportTypeStorage
|
||||
{
|
||||
public ReportTypeViewModel? Delete(ReportTypeBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.ReportTypes.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.ReportTypes.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ReportTypeViewModel? GetElement(ReportTypeSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ReportTypes
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name == model.Name) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<ReportTypeViewModel> GetFilteredList(ReportTypeSearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ReportTypes
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(string.IsNullOrEmpty(model.Name) || x.Name.Contains(model.Name))
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ReportTypeViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.ReportTypes.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ReportTypeViewModel? Insert(ReportTypeBindingModel model)
|
||||
{
|
||||
var newReportType = ReportType.Create(model);
|
||||
if (newReportType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.ReportTypes.Add(newReportType);
|
||||
context.SaveChanges();
|
||||
return newReportType.GetViewModel;
|
||||
}
|
||||
|
||||
public ReportTypeViewModel? Update(ReportTypeBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var reportType = context.ReportTypes.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (reportType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
reportType.Update(model);
|
||||
context.SaveChanges();
|
||||
return reportType.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,72 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class StatementStorage : IStatementStorage
|
||||
{
|
||||
public StatementViewModel? Delete(StatementBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.Statements.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Statements.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StatementViewModel? GetElement(StatementSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<StatementViewModel> GetFilteredList(StatementSearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id)
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<StatementViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Statements.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public StatementViewModel? Insert(StatementBindingModel model)
|
||||
{
|
||||
var newStatement = Statement.Create(model);
|
||||
if (newStatement == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.Statements.Add(newStatement);
|
||||
context.SaveChanges();
|
||||
return newStatement.GetViewModel;
|
||||
}
|
||||
|
||||
public StatementViewModel? Update(StatementBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var statement = context.Statements.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (statement == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
statement.Update(model);
|
||||
context.SaveChanges();
|
||||
return statement.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,74 @@ namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class StudentStorage : IStudentStorage
|
||||
{
|
||||
public StudentViewModel? Delete(StudentBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var element = context.Students.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Students.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StudentViewModel? GetElement(StudentSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Students
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name== model.Name) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<StudentViewModel> GetFilteredList(StudentSearchModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Students
|
||||
.Where(x => (
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(string.IsNullOrEmpty(model.Name) || x.Name.Contains(model.Name))
|
||||
)
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<StudentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
return context.Students.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public StudentViewModel? Insert(StudentBindingModel model)
|
||||
{
|
||||
var newStudent = Student.Create(model);
|
||||
if (newStudent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new UniversityDatabase();
|
||||
context.Students.Add(newStudent);
|
||||
context.SaveChanges();
|
||||
return newStudent.GetViewModel;
|
||||
}
|
||||
|
||||
public StudentViewModel? Update(StudentBindingModel model)
|
||||
{
|
||||
using var context = new UniversityDatabase();
|
||||
var student = context.Students.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (student == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
student.Update(model);
|
||||
context.SaveChanges();
|
||||
return student.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,31 @@ namespace UniversityDatabaseImplement.Models
|
||||
public int Number { get; set; }
|
||||
[ForeignKey("ActivityId")]
|
||||
public virtual List<ReportTypeActivity> ReportTypeActivities { get; set; } = new();
|
||||
|
||||
public static Activity Create(ActivityBindingModel model)
|
||||
{
|
||||
return new Activity
|
||||
{
|
||||
Id = model.Id,
|
||||
Date = model.Date,
|
||||
Number = model.Number
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ActivityBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
Date = model.Date;
|
||||
Number = model.Number;
|
||||
}
|
||||
|
||||
public ActivityViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Date = Date,
|
||||
Number = Number
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,31 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<Statement> Statements { get; set; } = new();
|
||||
[ForeignKey("DisciplineId")]
|
||||
public virtual List<ReportTypeDiscipline> ReportTypeDisciplines { get; set; } = new();
|
||||
|
||||
public static Discipline Create(DisciplineBindingModel model)
|
||||
{
|
||||
return new Discipline
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Department = model.Department
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(DisciplineBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
Name = model.Name;
|
||||
Department = model.Department;
|
||||
}
|
||||
|
||||
public DisciplineViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Department = Department
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,33 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<Activity> Activities { get; set; } = new();
|
||||
[ForeignKey("ExaminationResultId")]
|
||||
public virtual List<StudentExaminationResult> StudentExaminationResults { get; set; } = new();
|
||||
public static ExaminationResult Create(ExaminationResultBindingModel model)
|
||||
{
|
||||
return new ExaminationResult
|
||||
{
|
||||
Id = model.Id,
|
||||
ExaminationForm = model.ExaminationForm,
|
||||
Mark = model.Mark,
|
||||
Date = model.Date
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ExaminationResultBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
ExaminationForm = model.ExaminationForm;
|
||||
Mark = model.Mark;
|
||||
Date = model.Date;
|
||||
}
|
||||
|
||||
public ExaminationResultViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ExaminationForm = ExaminationForm,
|
||||
Mark = Mark,
|
||||
Date = Date
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,26 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<ReportTypeActivity> ReportTypeActivities { get; set; } = new();
|
||||
[ForeignKey("ReportTypeId")]
|
||||
public virtual List<ReportTypeDiscipline> ReportTypeDisciplines { get; set; } = new();
|
||||
public static ReportType Create(ReportTypeBindingModel model)
|
||||
{
|
||||
return new ReportType
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name
|
||||
};
|
||||
}
|
||||
public void Update(ReportTypeBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
Name = model.Name;
|
||||
}
|
||||
|
||||
public ReportTypeViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,5 @@ namespace UniversityDatabaseImplement.Models
|
||||
public int ActivityId { get; set; }
|
||||
public virtual ReportType ReportType { get; set; } = new();
|
||||
public virtual Activity Activity { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,29 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StatementId")]
|
||||
public virtual List<ExaminationResult> ExaminationResults { get; set; } = new();
|
||||
public static Statement Create(StatementBindingModel model)
|
||||
{
|
||||
return new Statement
|
||||
{
|
||||
Id = model.Id,
|
||||
Date = model.Date,
|
||||
HoursCount = model.HoursCount
|
||||
};
|
||||
}
|
||||
public void Update(StatementBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
Date = model.Date;
|
||||
HoursCount = model.HoursCount;
|
||||
}
|
||||
|
||||
public StatementViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Date = Date,
|
||||
HoursCount = HoursCount
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,29 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<StudentExaminationResult> StudentExaminationResults { get; set; } = new();
|
||||
public static Student Create(StudentBindingModel model)
|
||||
{
|
||||
return new Student
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
RecordCardNumber = model.RecordCardNumber
|
||||
};
|
||||
}
|
||||
public void Update(StudentBindingModel model)
|
||||
{
|
||||
if (model == null) return;
|
||||
|
||||
Id = model.Id;
|
||||
Name = model.Name;
|
||||
RecordCardNumber = model.RecordCardNumber;
|
||||
}
|
||||
|
||||
public StudentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
RecordCardNumber = RecordCardNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using UniversityDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PizzeriaDatabaseImplement
|
||||
namespace UniversityDatabaseImplement
|
||||
{
|
||||
public class PizzeriaDatabase : DbContext
|
||||
public class UniversityDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@ -13,15 +13,15 @@ namespace PizzeriaDatabaseImplement
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Activity> Activity { set; get; }
|
||||
public virtual DbSet<Discipline> Discipline { set; get; }
|
||||
public virtual DbSet<ExaminationResult> ExaminationResult { set; get; }
|
||||
public virtual DbSet<ReportType> ReportType { set; get; }
|
||||
public virtual DbSet<ReportTypeActivity> ReportTypeActivity { set; get; }
|
||||
public virtual DbSet<ReportTypeDiscipline> ReportTypeDiscipline { set; get; }
|
||||
public virtual DbSet<Statement> Statement { set; get; }
|
||||
public virtual DbSet<StatementStudent> StatementStudent { set; get; }
|
||||
public virtual DbSet<Student> Student { set; get; }
|
||||
public virtual DbSet<StudentExaminationResult> StudentExaminationResult { set; get; }
|
||||
public virtual DbSet<Activity> Activities { set; get; }
|
||||
public virtual DbSet<Discipline> Disciplines { set; get; }
|
||||
public virtual DbSet<ExaminationResult> ExaminationResults { set; get; }
|
||||
public virtual DbSet<ReportType> ReportTypes { set; get; }
|
||||
public virtual DbSet<ReportTypeActivity> ReportTypeActivities { set; get; }
|
||||
public virtual DbSet<ReportTypeDiscipline> ReportTypeDisciplines { set; get; }
|
||||
public virtual DbSet<Statement> Statements { set; get; }
|
||||
public virtual DbSet<StatementStudent> StatementStudents { set; get; }
|
||||
public virtual DbSet<Student> Students { set; get; }
|
||||
public virtual DbSet<StudentExaminationResult> StudentExaminationResults { set; get; }
|
||||
}
|
||||
}
|
@ -4,8 +4,8 @@ namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class ActivityBindingModel : IActivityModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Number { get; }
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Number { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class DisciplineBindingModel : IDisciplineModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public string Department { get; } = String.Empty;
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Department { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class ExaminationResultBindingModel : IExaminationResultModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string ExaminationForm { get; } = String.Empty;
|
||||
public MarkType Mark { get; } = MarkType.Неизвестен;
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Id { get; set; }
|
||||
public string ExaminationForm { get; set; } = String.Empty;
|
||||
public MarkType Mark { get; set; } = MarkType.Неизвестен;
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class ReportTypeBindingModel : IReportTypeModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class StatementBindingModel : IStatementModel
|
||||
public class StatementBindingModel : IStudentModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; }
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class StudentBindingModel : IStudentModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public string RecordCardNumber { get; } = String.Empty;
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string RecordCardNumber { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
public interface IActivityLogic
|
||||
{
|
||||
List<ActivityViewModel>? ReadList(ActivitySearchModel? model);
|
||||
ActivityViewModel? ReadElement(ActivitySearchModel model);
|
||||
bool Create(ActivityBindingModel model);
|
||||
bool Update(ActivityBindingModel model);
|
||||
bool Delete(ActivityBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
|
||||
public interface IDisciplineLogic
|
||||
{
|
||||
List<DisciplineViewModel>? ReadList(DisciplineSearchModel? model);
|
||||
DisciplineViewModel? ReadElement(DisciplineSearchModel model);
|
||||
bool Create(DisciplineBindingModel model);
|
||||
bool Update(DisciplineBindingModel model);
|
||||
bool Delete(DisciplineBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
public interface IExaminationResultLogic
|
||||
{
|
||||
List<ExaminationResultViewModel>? ReadList(ExaminationResultSearchModel? model);
|
||||
ExaminationResultViewModel? ReadElement(ExaminationResultSearchModel model);
|
||||
bool Create(ExaminationResultBindingModel model);
|
||||
bool Update(ExaminationResultBindingModel model);
|
||||
bool Delete(ExaminationResultBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
|
||||
public interface IReportTypeLogic
|
||||
{
|
||||
List<ReportTypeViewModel>? ReadList(ReportTypeSearchModel? model);
|
||||
ReportTypeViewModel? ReadElement(ReportTypeSearchModel model);
|
||||
bool Create(ReportTypeBindingModel model);
|
||||
bool Update(ReportTypeBindingModel model);
|
||||
bool Delete(ReportTypeBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
public interface IStatementLogic
|
||||
{
|
||||
List<StatementViewModel>? ReadList(StatementSearchModel? model);
|
||||
StatementViewModel? ReadElement(StatementSearchModel model);
|
||||
bool Create(StatementBindingModel model);
|
||||
bool Update(StatementBindingModel model);
|
||||
bool Delete(StatementBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BuisnessLogicContracts
|
||||
{
|
||||
public interface IStudentLogic
|
||||
{
|
||||
List<StudentViewModel>? ReadList(StudentSearchModel? model);
|
||||
StudentViewModel? ReadElement(StudentSearchModel model);
|
||||
bool Create(StudentBindingModel model);
|
||||
bool Update(StudentBindingModel model);
|
||||
bool Delete(StudentBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class ActivitySearchModel : IActivityModel
|
||||
public class ActivitySearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Number { get; }
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class DisciplineSearchModel : IDisciplineModel
|
||||
public class DisciplineSearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public string Department { get; } = String.Empty;
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,8 @@ using UniversityDataModels.Models;
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class ExaminationResultSearchModel : IExaminationResultModel
|
||||
public class ExaminationResultSearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string ExaminationForm { get; } = String.Empty;
|
||||
public MarkType Mark { get; } = MarkType.Неизвестен;
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class ReportTypeSearchModel : IReportTypeModel
|
||||
public class ReportTypeSearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class StatementSearchModel : IStatementModel
|
||||
public class StatementSearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; }
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class StudentSearchModel : IStudentModel
|
||||
public class StudentSearchModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public string RecordCardNumber { get; } = String.Empty;
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IActivityStorage
|
||||
{
|
||||
List<ActivityViewModel> GetFullList();
|
||||
List<ActivityViewModel> GetFilteredList(ActivitySearchModel model);
|
||||
ActivityViewModel? GetElement(ActivitySearchModel model);
|
||||
ActivityViewModel? Insert(ActivityBindingModel model);
|
||||
ActivityViewModel? Update(ActivityBindingModel model);
|
||||
ActivityViewModel? Delete(ActivityBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IDisciplineStorage
|
||||
{
|
||||
List<DisciplineViewModel> GetFullList();
|
||||
List<DisciplineViewModel> GetFilteredList(DisciplineSearchModel model);
|
||||
DisciplineViewModel? GetElement(DisciplineSearchModel model);
|
||||
DisciplineViewModel? Insert(DisciplineBindingModel model);
|
||||
DisciplineViewModel? Update(DisciplineBindingModel model);
|
||||
DisciplineViewModel? Delete(DisciplineBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IExaminationResultStorage
|
||||
{
|
||||
List<ExaminationResultViewModel> GetFullList();
|
||||
List<ExaminationResultViewModel> GetFilteredList(ExaminationResultSearchModel model);
|
||||
ExaminationResultViewModel? GetElement(ExaminationResultSearchModel model);
|
||||
ExaminationResultViewModel? Insert(ExaminationResultBindingModel model);
|
||||
ExaminationResultViewModel? Update(ExaminationResultBindingModel model);
|
||||
ExaminationResultViewModel? Delete(ExaminationResultBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IReportTypeStorage
|
||||
{
|
||||
List<ReportTypeViewModel> GetFullList();
|
||||
List<ReportTypeViewModel> GetFilteredList(ReportTypeSearchModel model);
|
||||
ReportTypeViewModel? GetElement(ReportTypeSearchModel model);
|
||||
ReportTypeViewModel? Insert(ReportTypeBindingModel model);
|
||||
ReportTypeViewModel? Update(ReportTypeBindingModel model);
|
||||
ReportTypeViewModel? Delete(ReportTypeBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IStatementStorage
|
||||
{
|
||||
List<StatementViewModel> GetFullList();
|
||||
List<StatementViewModel> GetFilteredList(StatementSearchModel model);
|
||||
StatementViewModel? GetElement(StatementSearchModel model);
|
||||
StatementViewModel? Insert(StatementBindingModel model);
|
||||
StatementViewModel? Update(StatementBindingModel model);
|
||||
StatementViewModel? Delete(StatementBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using UniversityDataModels.Models;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IStudentStorage
|
||||
{
|
||||
List<StudentViewModel> GetFullList();
|
||||
List<StudentViewModel> GetFilteredList(StudentSearchModel model);
|
||||
StudentViewModel? GetElement(StudentSearchModel model);
|
||||
StudentViewModel? Insert(StudentBindingModel model);
|
||||
StudentViewModel? Update(StudentBindingModel model);
|
||||
StudentViewModel? Delete(StudentBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ActivityViewModel : IActivityModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Number { get; }
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int Number { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class DisciplineViewModel : IDisciplineModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public string Department { get; } = String.Empty;
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Department { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
using UniversityDataModels.Enums;
|
||||
using UniversityDataModels.Models;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ExaminationResultSearchModel : IExaminationResultModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string ExaminationForm { get; } = String.Empty;
|
||||
public MarkType Mark { get; } = MarkType.Неизвестен;
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using UniversityDataModels.Enums;
|
||||
using UniversityDataModels.Models;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ExaminationResultViewModel : IExaminationResultModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ExaminationForm { get; set; } = String.Empty;
|
||||
public MarkType Mark { get; set; } = MarkType.Неизвестен;
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ReportTypeViewModel : IReportTypeModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; } = String.Empty;
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class StatementViewModel : IStatementModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; }
|
||||
public int Id { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class StudentViewModel : IStatementModel
|
||||
public class StudentViewModel : IStudentModel
|
||||
{
|
||||
public int Id { get; }
|
||||
public DateTime Date { get; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
public int HoursCount { get; }
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string RecordCardNumber { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user