diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/ProductController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/ProductController.cs index 5959c42e..063df06b 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/ProductController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/ProductController.cs @@ -1,5 +1,6 @@ using Application.Domain.Entities; using Application.Models; +using Infrastructure.Application; using Infrastructure.Data; using Infrastructure.Extensions; using Infrastructure.Web.Mvc; @@ -26,6 +27,16 @@ namespace IoT.Shared.Areas.Admin.Controlls return query.Include(o => o.Category); } + public override IQueryable Query(PagedListModel model, IQueryable query) + { + return base.Query(model, query) + .WhereIf(model.Query.CategoryId.HasValue, o => o.CategoryId == model.Query.CategoryId.Value) + .WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name)) + .WhereIf(!string.IsNullOrEmpty(model.Query.Number), o => o.Name.Contains(model.Query.Number)) + .WhereIf(!string.IsNullOrEmpty(model.Query.Path), o => o.Name.Contains(model.Query.Path)) + .WhereIf(!string.IsNullOrEmpty(model.Query.ApiJson), o => o.Name.Contains(model.Query.ApiJson)); + } + public override void ToDisplayModel(Product entity, EditProductModel model) { ViewData.Add(entity.CategoryId, entity.Category.Name); diff --git a/projects/WebMVC/wwwroot/js/components.js b/projects/WebMVC/wwwroot/js/components.js index f5c28c8e..234ccc54 100644 --- a/projects/WebMVC/wwwroot/js/components.js +++ b/projects/WebMVC/wwwroot/js/components.js @@ -7,4 +7,9 @@ Vue.component('layout', function (resolve, reject) { axios.get("/router/shared/layout.html").then(function (response) { resolve(parseModel(response)); }); +}); +Vue.component('list', function (resolve, reject) { + axios.get("/router/shared/list.html").then(function (response) { + resolve(parseModel(response)); + }); }); \ No newline at end of file diff --git a/projects/WebMVC/wwwroot/router/admin/home.html b/projects/WebMVC/wwwroot/router/admin/home.html index 9ffb89c5..ae379778 100644 --- a/projects/WebMVC/wwwroot/router/admin/home.html +++ b/projects/WebMVC/wwwroot/router/admin/home.html @@ -1,7 +1,5 @@