diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ClientController.cs b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ClientController.cs index 391d5f6..6dda81b 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ClientController.cs +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Controllers/ClientController.cs @@ -84,7 +84,7 @@ namespace BlacksmithWorkshopRestApi.Controllers return _mailLogic.ReadList(new MessageInfoSearchModel { ClientId = clientId, - Page = pageSize, + Page = page, PageSize = pageSize }); } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/MessageInfoStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/MessageInfoStorage.cs index 36fc609..d083600 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/MessageInfoStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/MessageInfoStorage.cs @@ -32,8 +32,19 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements { using var context = new BlacksmithWorkshopDatabase(); - var list = context.Messages - .Select(x => x.GetViewModel); + var list = new List(); + + if (model.ClientId.HasValue) + { + list = context.Messages + .Where(x => x.ClientId.HasValue && x.ClientId == model.ClientId) + .Select(x => x.GetViewModel).ToList(); + } + else + { + list = context.Messages + .Select(x => x.GetViewModel).ToList(); + } if (!(model.Page.HasValue && model.PageSize.HasValue)) {