фикс для замеров
This commit is contained in:
parent
293282019b
commit
f7dc7bb8d4
@ -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)
|
||||
{
|
||||
|
@ -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 = "Тeкущая СУБД: MongoDB";
|
||||
db = (Abstracts)(Program.ServiceProvider?.GetService(typeof(Abstracts)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -362,6 +363,7 @@ namespace DepartmentStaffView
|
||||
changeToPostgreSQL();
|
||||
MessageBox.Show("Данные были перемещены в БД на PostgreSQL");
|
||||
label1.Text = "Тeкущая СУБД: PostgreSQL";
|
||||
db = (Abstracts)(Program.ServiceProvider?.GetService(typeof(Abstracts)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user