TourIAm/TIAM.Database/DbSets/Users/UserProductMappingDbSetExte...

13 lines
584 B
C#

using TIAM.Database.DbContexts.ServiceProviders;
using TIAM.Entities.Users;
namespace TIAM.Database.DbSets.Users;
public static class UserProductMappingDbSetExtensions
{
public static UserProductMapping? GetUserProductMappingById(this IAssignedUserDbSet ctx, Guid userProductMappingId)
=> ctx.UserProductMappings.FirstOrDefault(x => x.Id == userProductMappingId);
public static IQueryable<UserProductMapping> GetUserProductMappingsByProductId(this IAssignedUserDbSet ctx, Guid productId)
=> ctx.UserProductMappings.Where(x => x.ProductId == productId);
}