diff --git a/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs b/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs index 108f8cf..da6b94a 100644 --- a/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs +++ b/Cop.Borovkov.Var3/Lab3.Database/Repository/Implementations/StudentRepository.cs @@ -57,7 +57,7 @@ namespace Lab3.Database.Repository.Implementations return _mapper.Map( await _context.Students .Include(s => s.StudentSessions) - .FirstOrDefaultAsync()); + .FirstOrDefaultAsync(s =>s.Id == id)); } public async Task UpdateAsync(StudentDTO studentDTO) diff --git a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs index ba949f3..5e388a6 100644 --- a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs +++ b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs @@ -1,13 +1,9 @@ using AutoMapper; using ComponentsLibrary.entities; using ComponentsLibrary.entities.enums; -using DocumentFormat.OpenXml.Bibliography; -using DocumentFormat.OpenXml.Drawing; -using DocumentFormat.OpenXml.Spreadsheet; using Lab3.Database.DTO; using Lab3.Database.Repository.Interfaces; using Lab3.Models; -using NPOI.OpenXml4Net.OPC.Internal; namespace Lab3.Forms { @@ -16,18 +12,21 @@ namespace Lab3.Forms private readonly IStudentRepository _studentRepository; private readonly IMapper _mapper; private readonly Func _getCreateOrUpdateForm; + private readonly CatalogForm _catalogForm; private bool _cont = false; public MainForm( IStudentRepository repository, IMapper mapper, - Func getCreateOrUpdateForm) + Func getCreateOrUpdateForm, + CatalogForm catalogForm) { _studentRepository = repository; _mapper = mapper; _getCreateOrUpdateForm = getCreateOrUpdateForm; + _catalogForm = catalogForm; InitializeComponent(); } @@ -232,16 +231,20 @@ namespace Lab3.Forms { CreateWordDocAsync(); } + else if (_cont && keyData == Keys.G) + { + _catalogForm.ShowDialog(this); + } if (keyData == Keys.A || keyData == Keys.U || keyData == Keys.D || keyData == Keys.S || keyData == Keys.T || - keyData == Keys.C) _cont = false; - //if (keyData != Keys.None && keyData != (System.Windows.Forms.Keys.ControlKey | System.Windows.Forms.Keys.Control)) cont = false; + keyData == Keys.C || + keyData == Keys.G) _cont = false; + return true; - return base.ProcessCmdKey(ref msg, keyData); } } }