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/Platform/Areas/Admin/Controllers/SiteController.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.Linq;
namespace Platform.Areas.Settings.Controllers
{
[Authorize]
[ApiController]
[Route("Admin/[controller]/[action]")]
[Area("Admin")]
[ControllerScope(ControllerScopeType.Platform)]
public class SiteController : CrudController<Site, EditSiteModel>
{
public SiteController(IRepository<Site> siteRepo) : base(siteRepo)
{
}
public override IQueryable<Site> Query(PagedListModel<EditSiteModel> model, IQueryable<Site> 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);
}
}
}