|
|
|
@ -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<Product> Query(PagedListModel<EditProductModel> model, IQueryable<Product> 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);
|
|
|
|
|