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.Linq; namespace Platform.Areas.Settings.Controllers { [Authorize] [ApiController] [Route("Admin/[controller]/[action]")] [Area("Admin")] [ControllerScope(ControllerScopeType.Platform)] public class SiteController : CrudController { public SiteController(IRepository siteRepo) : base(siteRepo) { } public override IQueryable Query(PagedListModel model, IQueryable query) { return query.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name)) .WhereIf(!string.IsNullOrEmpty(model.Query.Description), o => o.Description.Contains(model.Query.Description)) .WhereIf(!string.IsNullOrEmpty(model.Query.Key), o => o.Key.Contains(model.Query.Key)) .WhereIf(!string.IsNullOrEmpty(model.Query.Login), o => o.Login.Contains(model.Query.Login)) .WhereIf(!string.IsNullOrEmpty(model.Query.Logout), o => o.Logout.Contains(model.Query.Logout)) .OrderBy(o => o.Order) .ThenBy(o => o.Name); } } }