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.
iot/projects/IoTNode/Areas/IoTCenter/Controllers/IoTGatewayController.cs

36 lines
1.4 KiB

using Infrastructure.Application;
using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Web.Mvc;
using Application.Domain.Entities;
using IoT.Shared.Application.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
namespace IoT.Shared.Areas.IoTCenter.Controlls
{
[Authorize]
[ApiController]
[Route("IoTCenter/[controller]/[action]")]
[Area("IoTCenter")]
[ControllerScope(ControllerScopeType.Platform)]
public class IoTGatewayController : CrudController<IoTGateway, EditIoTGatewayModel>
{
public IoTGatewayController(IRepository<IoTGateway> repo) : base(repo)
{
}
public override IQueryable<IoTGateway> Query(PagedListModel<EditIoTGatewayModel> model, IQueryable<IoTGateway> 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.Version), o => o.Version.Contains(model.Query.Version))
.WhereIf(model.Query.IsOnline.HasValue, o => o.IsOnline == model.Query.IsOnline.Value)
.WhereIf(model.Query.Hidden.HasValue, o => o.Hidden == model.Query.Hidden.Value);
}
}
}