You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.6 KiB
37 lines
1.6 KiB
using Infrastructure.Application;
|
|
using Infrastructure.Data;
|
|
using Infrastructure.Extensions;
|
|
using Infrastructure.Web.Mvc;
|
|
using IoT.Shared.Application.Domain.Entities;
|
|
using IoT.Shared.Application.Models;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Linq;
|
|
|
|
namespace IoT.Shared.Areas.IoTCenter.Controlls
|
|
{
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("IoTCenter/[controller]/[action]")]
|
|
[Area("IoTCenter")]
|
|
[ControllerScope(ControllerScopeType.Platform)]
|
|
public class IoTProductController : CrudController<IoTProduct, EditIoTProductModel>
|
|
{
|
|
public IoTProductController(IRepository<IoTProduct> repo) : base(repo)
|
|
{
|
|
}
|
|
|
|
public override IQueryable<IoTProduct> Query(PagedListModel<EditIoTProductModel> model, IQueryable<IoTProduct> query)
|
|
{
|
|
return base.Query(model, query)
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.Number), o => o.Number.Contains(model.Query.Number))
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.Number), o => o.Number.Contains(model.Query.Number))
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.Path), o => o.Path.Contains(model.Query.Path))
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.Path), o => o.Path.Contains(model.Query.Path))
|
|
.WhereIf(!string.IsNullOrEmpty(model.Query.ApiJson), o => o.ApiJson.Contains(model.Query.ApiJson))
|
|
.OrderBy(o => o.Number);
|
|
}
|
|
}
|
|
}
|