using IMCS.CCS.Entitys; using IMCS.CCS.Repository; using IMCS_CCS.Entitys; using System.Collections.Generic; using System.Linq; namespace IMCS_CCS.Repository { public class CcsActionDeviceSourceCheckRepository : ICcsActionDeviceSourceCheckRepository { private readonly CcsContext _context; public CcsActionDeviceSourceCheckRepository(CcsContext context) { _context = context; } public List GetList(CcsActionDeviceSourceCheck vo) { IQueryable actions = _context.CcsActionDeviceSourceCheck; if (vo.Enable == null) { vo.Enable = 1; } actions = actions.Where(x => x.Enable == vo.Enable); if (vo.ActionId != null) { actions = actions.Where(x => x.ActionId == vo.ActionId); } if (!string.IsNullOrEmpty(vo.Type)) { actions = actions.Where(x => x.Type == vo.Type); } if (!string.IsNullOrEmpty(vo.DeviceCode)) { actions = actions.Where(x => x.DeviceCode == vo.DeviceCode); } if (!string.IsNullOrEmpty(vo.DeviceSource)) { actions = actions.Where(x => x.DeviceSource == vo.DeviceSource); } List< CcsActionDeviceSourceCheck > aa = actions.OrderBy(x => x.CheckSort).ToList(); return aa; } } }