фикс для замеров

This commit is contained in:
frog24 2024-05-20 22:57:21 +04:00
parent 293282019b
commit f7dc7bb8d4
2 changed files with 8 additions and 2 deletions

View File

@ -48,7 +48,11 @@ namespace DepartmentStaffDatabase
}
public override void UpdateDepartment(Department department)
{
_departmentCollection.ReplaceOne(dep => dep.Id == dep.Id, department);
var filter = Builders<Department>.Filter.Eq(pos => pos.Id, department.Id);
var update = Builders<Department>.Update
.Set(pos => pos.DepartmentName, department.DepartmentName)
.Set(pos => pos.Head, department.Head);
_departmentCollection.UpdateOne(filter, update);
}
public override void DeleteDepartment(int id)
{

View File

@ -15,7 +15,7 @@ namespace DepartmentStaffView
{
public partial class FormMain : Form
{
private readonly Abstracts db;
private Abstracts db;
public FormMain(Abstracts abstracts)
{
InitializeComponent();
@ -354,6 +354,7 @@ namespace DepartmentStaffView
changeToMongoDB();
MessageBox.Show("Данные были перемещены в БД на MongoDB");
label1.Text = "Тущая СУБД: MongoDB";
db = (Abstracts)(Program.ServiceProvider?.GetService(typeof(Abstracts)));
}
else
{
@ -362,6 +363,7 @@ namespace DepartmentStaffView
changeToPostgreSQL();
MessageBox.Show("Данные были перемещены в БД на PostgreSQL");
label1.Text = "Тущая СУБД: PostgreSQL";
db = (Abstracts)(Program.ServiceProvider?.GetService(typeof(Abstracts)));
}
}
}