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/IoT.Shared/Areas/Admin/Controlls/LiveRecordController.cs

32 lines
1.2 KiB

using System.Linq;
using Application.Domain.Entities;
using Application.Models;
using Infrastructure.Application;
using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Web.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IoT.Shared.Areas.Admin.Controlls
{
[Authorize]
[Area(nameof(Admin))]
public class LiveRecordController : CrudController<LiveRecord, SearchLiveRecordModel, EditLiveRecordModel, EditLiveRecordModel>
{
private readonly AjaxController _ajax;
public LiveRecordController(IRepository<LiveRecord> repo, AjaxController ajax) : base(repo)
{
this._ajax = ajax;
}
public override IQueryable<LiveRecord> Query(SearchLiveRecordModel model, IQueryable<LiveRecord> query)
{
ViewData.SelectList(o => model.DeviceNumber, () => this._ajax.GetCameraSelectList(model.DeviceNumber));
return query
.WhereIf(!string.IsNullOrEmpty(model.DeviceNumber), o => o.DeviceNumber == model.DeviceNumber)
.WhereIf(!string.IsNullOrEmpty(model.Keyword), o => o.DeviceName.Contains(model.Keyword) || o.Name.Contains(model.Keyword));
}
}
}