фиксы небольших моментов

This commit is contained in:
bekodeg 2024-11-24 13:20:49 +04:00
parent 7ca62ddb1d
commit 2bb8b42453
2 changed files with 12 additions and 9 deletions

View File

@ -57,7 +57,7 @@ namespace Lab3.Database.Repository.Implementations
return _mapper.Map<StudentDTO>(
await _context.Students
.Include(s => s.StudentSessions)
.FirstOrDefaultAsync());
.FirstOrDefaultAsync(s =>s.Id == id));
}
public async Task<StudentDTO?> UpdateAsync(StudentDTO studentDTO)

View File

@ -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<Guid?, CreateForm> _getCreateOrUpdateForm;
private readonly CatalogForm _catalogForm;
private bool _cont = false;
public MainForm(
IStudentRepository repository,
IMapper mapper,
Func<Guid?, CreateForm> getCreateOrUpdateForm)
Func<Guid?, CreateForm> 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);
}
}
}