перевод на асинхронность в бд

This commit is contained in:
kotcheshir73 2021-04-14 13:47:48 +04:00
parent d93117f01a
commit fcad2e9815
11 changed files with 95 additions and 90 deletions

View File

@ -8,6 +8,7 @@ using ModuleTools.Models;
using ModuleTools.ViewModels;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace DatabaseCore
{
@ -18,7 +19,7 @@ namespace DatabaseCore
where L : ListViewModel<E>, new()
where E : ElementViewModel
{
public OperationResultModel Create(S model)
public async Task<OperationResultModel> CreateAsync(S model)
{
using var context = DatabaseManager.GetContext;
@ -32,8 +33,8 @@ namespace DatabaseCore
if (exsistEntity == null)
{
var entity = Mapper.MapToClass<S, T>(model, true);
context.Set<T>().Add(entity);
context.SaveChanges();
await context.Set<T>().AddAsync(entity);
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<T, E>(entity, true));
}
else
@ -42,7 +43,7 @@ namespace DatabaseCore
{
exsistEntity = Mapper.MapToClass(model, exsistEntity, true);
exsistEntity.IsDeleted = false;
context.SaveChanges();
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<T, E>(exsistEntity, true));
}
else
@ -52,7 +53,7 @@ namespace DatabaseCore
}
}
public OperationResultModel Delete(G model)
public async Task<OperationResultModel> DeleteAsync(G model)
{
using var context = DatabaseManager.GetContext;
using var transaction = context.Database.BeginTransaction();
@ -77,22 +78,22 @@ namespace DatabaseCore
entity.IsDeleted = true;
entity.DateDelete = DateTime.Now;
context.SaveChanges();
await context.SaveChangesAsync();
AdditionalDeleting(context, entity, model);
transaction.Commit();
await transaction.CommitAsync();
}
catch (Exception)
{
transaction.Rollback();
await transaction.RollbackAsync();
throw;
}
return OperationResultModel.Success(true);
}
public OperationResultModel Read(G model)
public async Task<OperationResultModel> ReadAsync(G model)
{
int countPages = 0;
using var context = DatabaseManager.GetContext;
@ -114,26 +115,29 @@ namespace DatabaseCore
query = OrderingWhenReading(query);
if (model.PageNumber.HasValue && model.PageSize.HasValue)
{
countPages = (int)Math.Ceiling((double)query.Count() / model.PageSize.Value);
query = query
.Skip(model.PageSize.Value * model.PageNumber.Value)
.Take(model.PageSize.Value);
}
query = IncludingWhenReading(query);
var result = new L
return await Task.Run(() =>
{
MaxCount = countPages,
List = query.Select(x => Mapper.MapToClass<T, E>(x, model.HaveRight)).ToList()
};
return OperationResultModel.Success(result);
if (model.PageNumber.HasValue && model.PageSize.HasValue)
{
countPages = (int)Math.Ceiling((double)query.Count() / model.PageSize.Value);
query = query
.Skip(model.PageSize.Value * model.PageNumber.Value)
.Take(model.PageSize.Value);
}
var result = new L
{
MaxCount = countPages,
List = query.Select(x => Mapper.MapToClass<T, E>(x, model.HaveRight)).ToList()
};
return OperationResultModel.Success(result);
});
}
public OperationResultModel Update(S model)
public async Task<OperationResultModel> UpdateAsync(S model)
{
using var context = DatabaseManager.GetContext;
@ -160,7 +164,7 @@ namespace DatabaseCore
}
entity = Mapper.MapToClass(model, entity, true);
context.SaveChanges();
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<T, E>(entity, true));
}

View File

@ -12,6 +12,7 @@ using ModuleTools.ViewModels;
using System;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
@ -120,7 +121,7 @@ namespace DesktopTools.Controls
_controlViewEntityElement = this;
}
public void OpenControl(ControlOpenModel model)
public async void OpenControl(ControlOpenModel model)
{
if (model.CloseElement != null)
{
@ -139,7 +140,7 @@ namespace DesktopTools.Controls
}
if (model.ElementId.HasValue)
{
Element = _businessLogic.GetElement(new G { Id = model.ElementId });
Element = await _businessLogic.GetElementAsync(new G { Id = model.ElementId });
if (Element == null)
{
DialogHelper.MessageException(_businessLogic.Errors, $"{Title}. Ошибки при получении элемента");
@ -164,7 +165,7 @@ namespace DesktopTools.Controls
private void InitEvents()
{
toolStripButtonSave.Click += (object sender, EventArgs e) => { Save(); };
toolStripButtonSave.Click += async (object sender, EventArgs e) => { await SaveAsync(); };
toolStripButtonReload.Click += (object sender, EventArgs e) =>
{
if (DialogHelper.MessageQuestion("Отменить все внесенные изменения?") == DialogResult.Yes)
@ -179,11 +180,11 @@ namespace DesktopTools.Controls
}
}
};
toolStripButtonClose.Click += (object sender, EventArgs e) =>
toolStripButtonClose.Click += async (object sender, EventArgs e) =>
{
if (_haveChages && DialogHelper.MessageQuestion("Имеется несохраненные данные, вы действительно хотите закрыть элемент?", "Закрытие элемента") == DialogResult.Yes)
{
if (!Save())
if (!(await SaveAsync()))
{
return;
}
@ -348,7 +349,7 @@ namespace DesktopTools.Controls
}
}
private bool Save()
private async Task<bool> SaveAsync()
{
if (CheckValues.GetInvocationList().Select(x => (bool)x.DynamicInvoke()).ToList().Any(x => !x))
{
@ -368,11 +369,11 @@ namespace DesktopTools.Controls
{
if (Element == null)
{
Element = _businessLogic.Create(model);
Element = await _businessLogic.CreateAsync(model);
}
else
{
Element = _businessLogic.Update(model);
Element = await _businessLogic.UpdateAsync(model);
}
if (Element == null)

View File

@ -99,7 +99,7 @@ namespace DesktopTools.Controls
public IControl GetInstanceControl() => _genericControlViewEntityList?.GetInstanceGenericControl();
public string GetTitleFromIdControl(Guid id) => _businessLogic.GetElement(new G { Id = id })?.ToString();
public string GetTitleFromIdControl(Guid id) => _businessLogic.GetElementAsync(new G { Id = id }).Result?.ToString();
public string SaveControlToXml() => new XElement("Control",
new XAttribute("Type", GetType().FullName),
@ -290,10 +290,10 @@ namespace DesktopTools.Controls
{
toolStripButtonAdd.Click += (object sender, EventArgs e) => { AddElement(); };
toolStripButtonUpd.Click += (object sender, EventArgs e) => { UpdElement(); };
toolStripButtonDel.Click += (object sender, EventArgs e) => { DelElement(); };
toolStripButtonDel.Click += async (object sender, EventArgs e) => { await DelElementAsync(); };
toolStripButtonSearch.Click += (object sender, EventArgs e) => { panelSearch.Visible = !panelSearch.Visible; };
toolStripButtonRef.Click += async (object sender, EventArgs e) => { await LoadListAsync(); };
toolStripButtonSelect.Click += (object sender, EventArgs e) => { SelectElement(); };
toolStripButtonSelect.Click += async (object sender, EventArgs e) => { await SelectElement(); };
toolStripButtonClose.Click += (object sender, EventArgs e) =>
{
CloseListEvent?.Invoke(ControlId);
@ -302,9 +302,9 @@ namespace DesktopTools.Controls
};
buttonSearch.Click += async (object sender, EventArgs e) => { await LoadListAsync(); };
buttonCancelSearch.Click += (object sender, EventArgs e) => { panelSearch.Visible = false; };
buttonCancelSearch.Click += async (object sender, EventArgs e) => { panelSearch.Visible = false; await LoadListAsync(); };
dataGridViewList.KeyDown += (object sender, KeyEventArgs e) =>
dataGridViewList.KeyDown += async (object sender, KeyEventArgs e) =>
{
switch (e.KeyCode)
{
@ -323,16 +323,16 @@ namespace DesktopTools.Controls
case Keys.Delete:
if (toolStripButtonDel.Visible)
{
DelElement();
await DelElementAsync();
}
break;
}
};
dataGridViewList.CellDoubleClick += (object sender, DataGridViewCellEventArgs e) =>
dataGridViewList.CellDoubleClick += async (object sender, DataGridViewCellEventArgs e) =>
{
if (_openMode == ControlOpenMode.Select && dataGridViewList.SelectedRows.Count > 0)
{
SelectElement();
await SelectElement();
}
UpdElement();
};
@ -440,7 +440,7 @@ namespace DesktopTools.Controls
}
}
}
await Task.Run(() => data = _businessLogic.GetList(model));
data = await _businessLogic.GetListAsync(model);
if (data == null && _businessLogic.Errors.Count > 0)
{
DialogHelper.MessageException(_businessLogic.Errors, $"{Title}. Ошибки при получении данных");
@ -513,7 +513,7 @@ namespace DesktopTools.Controls
/// <summary>
/// Вызов события при удалении элемента
/// </summary>
private async void DelElement()
private async Task DelElementAsync()
{
if (MessageBox.Show("Удалить выбранные записи?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
@ -523,7 +523,7 @@ namespace DesktopTools.Controls
Cursor.Current = Cursors.WaitCursor;
foreach (DataGridViewRow selected in dataGridViewList.SelectedRows)
{
_businessLogic.Delete(new G { Id = new Guid(selected.Cells[0].Value.ToString()) });
await _businessLogic.DeleteAsync(new G { Id = new Guid(selected.Cells[0].Value.ToString()) });
}
}
catch (Exception ex)
@ -548,12 +548,12 @@ namespace DesktopTools.Controls
/// <summary>
/// Вызов события при выборе элемента
/// </summary>
private void SelectElement()
private async Task SelectElement()
{
try
{
SelectedId = new Guid(dataGridViewList.SelectedRows[0].Cells[0].Value.ToString());
SelectedText = _businessLogic.GetElement(new G { Id = SelectedId })?.ToString();
SelectedText = (await _businessLogic.GetElementAsync(new G { Id = SelectedId }))?.ToString();
CloseSelectEvent?.Invoke(true);
Dispose();
}

View File

@ -3,6 +3,7 @@ using ModuleTools.Enums;
using ModuleTools.Interfaces;
using ModuleTools.ViewModels;
using System;
using System.Threading.Tasks;
namespace ModuleTools.BusinessLogics
{
@ -41,7 +42,7 @@ namespace ModuleTools.BusinessLogics
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public L GetList(G model)
public async Task<L> GetListAsync(G model)
{
Errors.Clear();
try
@ -51,7 +52,7 @@ namespace ModuleTools.BusinessLogics
{
throw new MethodAccessException("Нет прав на получение списка");
}
var result = Service.Read(model);
var result = await Service.ReadAsync(model);
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);
@ -72,7 +73,7 @@ namespace ModuleTools.BusinessLogics
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public E GetElement(G model)
public async Task<E> GetElementAsync(G model)
{
Errors.Clear();
try
@ -82,7 +83,7 @@ namespace ModuleTools.BusinessLogics
{
throw new MethodAccessException("Нет прав на получение списка");
}
var result = Service.Read(model);
var result = await Service.ReadAsync(model);
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);
@ -102,7 +103,7 @@ namespace ModuleTools.BusinessLogics
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public E Create(S model)
public async Task<E> CreateAsync(S model)
{
Errors.Clear();
try
@ -111,7 +112,7 @@ namespace ModuleTools.BusinessLogics
{
return null;
}
var result = Service.Create(model);
var result = await Service.CreateAsync(model);
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);
@ -132,7 +133,7 @@ namespace ModuleTools.BusinessLogics
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public E Update(S model)
public async Task<E> UpdateAsync(S model)
{
Errors.Clear();
try
@ -141,7 +142,7 @@ namespace ModuleTools.BusinessLogics
{
return null;
}
var result = Service.Update(model);
var result = await Service.UpdateAsync(model);
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);
@ -162,7 +163,7 @@ namespace ModuleTools.BusinessLogics
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool Delete(G model)
public async Task<bool> DeleteAsync(G model)
{
Errors.Clear();
try
@ -171,7 +172,7 @@ namespace ModuleTools.BusinessLogics
{
return false;
}
var result = Service.Delete(model);
var result = await Service.DeleteAsync(model);
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);

View File

@ -1,5 +1,6 @@
using ModuleTools.BindingModels;
using ModuleTools.Models;
using System.Threading.Tasks;
namespace ModuleTools.Interfaces
{
@ -15,27 +16,27 @@ namespace ModuleTools.Interfaces
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
OperationResultModel Read(G model);
Task<OperationResultModel> ReadAsync(G model);
/// <summary>
/// Создание новой сущности
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
OperationResultModel Create(S model);
Task<OperationResultModel> CreateAsync(S model);
/// <summary>
/// Изменение сущности
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
OperationResultModel Update(S model);
Task<OperationResultModel> UpdateAsync(S model);
/// <summary>
/// Удаление сущности
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
OperationResultModel Delete(G model);
Task<OperationResultModel> DeleteAsync(G model);
}
}

View File

@ -38,7 +38,7 @@ namespace DepartmentWindowsDesktop.EntityControls
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = true,
PageNamesForPagination = _disciplineBlockBusinessLogic.GetList(new DisciplineBlockGetBindingModel())?.List?.Select(x =>
PageNamesForPagination = _disciplineBlockBusinessLogic.GetListAsync(new DisciplineBlockGetBindingModel()).Result?.List?.Select(x =>
new PageNamesForPaginationModel
{
Key = x.Id,

View File

@ -13,6 +13,7 @@ using SecurityBusinessLogic.BusinessLogics;
using SecurityBusinessLogic.ViewModels;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DepartmentWindowsDesktop.EntityControls
{
@ -37,22 +38,22 @@ namespace DepartmentWindowsDesktop.EntityControls
{
ControlOnMoveElem = new Dictionary<string, (string Title, EventHandler Event)>
{
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", (object sender, EventArgs e) => { AddUser(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", (object sender, EventArgs e) => { PasswordReset(); }) }
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", async (object sender, EventArgs e) => { await AddUserAsync(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", async (object sender, EventArgs e) => { await PasswordResetAsync(); }) }
}
};
/// <summary>
/// Поиск пользователя под учетку, либо добавление нового, если не найдено
/// </summary>
private void AddUser()
private async Task AddUserAsync()
{
var model = new EmployeeSetBindingModel();
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var userName = $"{model.LastName}{(model.FirstName.IsNotEmpty() ? $" {model.FirstName[0]}." : string.Empty)}{(model.Patronymic.IsNotEmpty() ? $"{model.Patronymic[0]}." : string.Empty)}";
var result = logic.GetList(new UserGetBindingModel { UserNameForSearch = userName });
var result = await logic.GetListAsync(new UserGetBindingModel { UserNameForSearch = userName });
if (result != null)
{
if (result.List.Count > 1)
@ -66,7 +67,7 @@ namespace DepartmentWindowsDesktop.EntityControls
}
else
{
var newuser = logic.Create(new UserSetBindingModel
var newuser = await logic.CreateAsync(new UserSetBindingModel
{
Login = userName,
Password = model.DateBirth.ToShortDateString(),
@ -91,7 +92,7 @@ namespace DepartmentWindowsDesktop.EntityControls
/// <summary>
/// Сброс пароля пользователя
/// </summary>
private void PasswordReset()
private async Task PasswordResetAsync()
{
if (_element == null)
{
@ -101,14 +102,14 @@ namespace DepartmentWindowsDesktop.EntityControls
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var user = logic.GetElement(new UserGetBindingModel { Id = _element.UserId });
var user = await logic.GetElementAsync(new UserGetBindingModel { Id = _element.UserId });
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.DateBirth.ToShortDateString();
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
user = await logic.UpdateAsync(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");

View File

@ -13,6 +13,7 @@ using SecurityBusinessLogic.BusinessLogics;
using SecurityBusinessLogic.ViewModels;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DepartmentWindowsDesktop.EntityControls
{
@ -37,22 +38,22 @@ namespace DepartmentWindowsDesktop.EntityControls
{
ControlOnMoveElem = new Dictionary<string, (string Title, EventHandler Event)>
{
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", (object sender, EventArgs e) => { AddUser(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", (object sender, EventArgs e) => { PasswordReset(); }) }
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", async (object sender, EventArgs e) => { await AddUserAsunc(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", async (object sender, EventArgs e) => { await PasswordResetAsync(); }) }
}
};
/// <summary>
/// Поиск пользователя под учетку, либо добавление нового, если не найдено
/// </summary>
private void AddUser()
private async Task AddUserAsunc()
{
var model = new LecturerSetBindingModel();
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var userName = $"{model.LastName}{(model.FirstName.IsNotEmpty() ? $" {model.FirstName[0]}." : string.Empty)}{(model.Patronymic.IsNotEmpty() ? $"{model.Patronymic[0]}." : string.Empty)}";
var result = logic.GetList(new UserGetBindingModel { UserNameForSearch = userName });
var result = await logic.GetListAsync(new UserGetBindingModel { UserNameForSearch = userName });
if (result != null)
{
if (result.List.Count > 1)
@ -66,7 +67,7 @@ namespace DepartmentWindowsDesktop.EntityControls
}
else
{
var newuser = logic.Create(new UserSetBindingModel
var newuser = await logic.CreateAsync(new UserSetBindingModel
{
Login = userName,
Password = model.DateBirth.ToShortDateString(),
@ -91,7 +92,7 @@ namespace DepartmentWindowsDesktop.EntityControls
/// <summary>
/// Сброс пароля пользователя
/// </summary>
private void PasswordReset()
private async Task PasswordResetAsync()
{
if (_element == null)
{
@ -101,14 +102,14 @@ namespace DepartmentWindowsDesktop.EntityControls
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var user = logic.GetElement(new UserGetBindingModel { Id = _element.UserId });
var user = await logic.GetElementAsync(new UserGetBindingModel { Id = _element.UserId });
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.DateBirth.ToShortDateString();
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
user = await logic.UpdateAsync(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");

View File

@ -3,11 +3,6 @@ namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlOrderStudentRecordList
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>

View File

@ -13,6 +13,7 @@ using SecurityBusinessLogic.BusinessLogics;
using SecurityBusinessLogic.ViewModels;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DepartmentWindowsDesktop.EntityControls
{
@ -37,22 +38,22 @@ namespace DepartmentWindowsDesktop.EntityControls
{
ControlOnMoveElem = new Dictionary<string, (string Title, EventHandler Event)>
{
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", (object sender, EventArgs e) => { AddUser(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", (object sender, EventArgs e) => { PasswordReset(); }) }
{ "ToolStripMenuItemAddUser", ("Добавить пользователя", async (object sender, EventArgs e) => { await AddUserAsync(); }) },
{ "ToolStripMenuItemPasswordReset", ("Сброс пароля пользователя", async (object sender, EventArgs e) => { await PasswordResetAsync(); }) }
}
};
/// <summary>
/// Поиск пользователя под учетку, либо добавление нового, если не найдено
/// </summary>
private void AddUser()
private async Task AddUserAsync()
{
var model = new StudentSetBindingModel();
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var userName = $"{model.LastName}{(model.FirstName.IsNotEmpty() ? $" {model.FirstName[0]}." : string.Empty)}{(model.Patronymic.IsNotEmpty() ? $"{model.Patronymic[0]}." : string.Empty)}";
var result = logic.GetList(new UserGetBindingModel { UserNameForSearch = userName });
var result = await logic.GetListAsync(new UserGetBindingModel { UserNameForSearch = userName });
if (result != null)
{
if (result.List.Count > 1)
@ -66,7 +67,7 @@ namespace DepartmentWindowsDesktop.EntityControls
}
else
{
var newuser = logic.Create(new UserSetBindingModel
var newuser = await logic.CreateAsync(new UserSetBindingModel
{
Login = userName,
Password = model.NumberOfBook,
@ -91,7 +92,7 @@ namespace DepartmentWindowsDesktop.EntityControls
/// <summary>
/// Сброс пароля пользователя
/// </summary>
private void PasswordReset()
private async Task PasswordResetAsync()
{
if (_element == null)
{
@ -101,14 +102,14 @@ namespace DepartmentWindowsDesktop.EntityControls
if (FillModel(model))
{
var logic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
var user = logic.GetElement(new UserGetBindingModel { Id = _element.UserId });
var user = await logic.GetElementAsync(new UserGetBindingModel { Id = _element.UserId });
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.NumberOfBook;
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
user = await logic.UpdateAsync(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");

View File

@ -39,7 +39,7 @@ namespace SecurityWindowsDesktop.EntityControls
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = true,
PageNamesForPagination = _roleBusinessLogic.GetList(new RoleGetBindingModel())?.List?.Select(x =>
PageNamesForPagination = _roleBusinessLogic.GetListAsync(new RoleGetBindingModel()).Result?.List?.Select(x =>
new PageNamesForPaginationModel
{
Key = x.Id,