using InSituLaboratory.Entities; using InSituLaboratory.IService; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InSituLaboratory.Service { public class RoleService : BaseService, IRoleService { public RoleService(DbContext context) : base(context) { } public bool CheckRoleName(string roleName, int roleId) { return this.Query(r => r.RoleName == roleName && r.RoleId != roleId) .Count() > 0; } public IEnumerable GetRoles(string key) { return this.Set() .Include(r => r.Users) .Include(r => r.Menus) .Where(r => string.IsNullOrEmpty(key) || r.RoleName.Contains(key) || r.RoleDesc.Contains(key) ); //return this.Query(m => // string.IsNullOrEmpty(key) || // m.RoleName.Contains(key) || // m.RoleDesc.Contains(key) //); } } }