23 lines
684 B
C#
23 lines
684 B
C#
using System.Linq.Expressions;
|
|
|
|
namespace MessengerBroker
|
|
{
|
|
public static class EntityExtensions
|
|
{
|
|
public static IQueryable<Db.Model.User> GetUsers(this IQueryable<Db.Model.User> source, Guid[] guids)
|
|
{
|
|
return source.Where(x => guids.Any(g => g == x.Id));
|
|
}
|
|
|
|
public static IQueryable<Db.Model.User> GetUsersExcept(this IQueryable<Db.Model.User> source, IEnumerable<Guid> guids)
|
|
{
|
|
return source.Where(x => !guids.Any(g => g == x.Id));
|
|
}
|
|
|
|
public static bool GetUserExists(this IQueryable<Db.Model.User> source, Guid id)
|
|
{
|
|
return source.Any(x=> x.Id == id);
|
|
}
|
|
}
|
|
}
|