/// <summary> /// Gets a partner service by service type id /// </summary> public PartnerService GetPartnerServiceByType(int partnerId, PartnerServiceType partnerServiceType) { if (partnerId <= 0) { throw new ArgumentOutOfRangeException("partnerId"); } return(this.Repository.GetSet <PartnerService>() .Where(x => x.IsActive) .Where(x => x.PartnerId == partnerId) .Where(x => x.PartnerServiceTypeId == (int)partnerServiceType) .FirstOrDefault()); }
/// <summary> /// Determines if a partner offers a service /// </summary> public bool PartnerOffersService(int partnerId, PartnerServiceType partnerServiceType) { if (partnerId <= 0) { throw new ArgumentOutOfRangeException("partnerId"); } int?userId = null; var user = this.UserResolver.Resolve(); if (user != null) { userId = user.UserId; } return(this.Repository.GetSet <Partner>() .Where(x => x.IsActive && x.IsPublic) .Any(x => x.PartnerServices.Any(y => y.IsActive && (y.IsPublic || (userId != null && x.UserPartnerAdmins.Any(z => z.UserId == userId && z.IsActive)))))); }
/// <summary> /// Determines if the Partner is signed up for a specific service /// </summary> public bool HasService(PartnerServiceType partnerServiceType) { return(this.Services.Any(x => x.PartnerServiceTypeId == (int)partnerServiceType)); }
/// <summary> /// Determines if the Partner is signed up for a specific service /// </summary> public bool HasService(PartnerServiceType partnerServiceType) { return this.Services.Any(x => x.PartnerServiceTypeId == (int)partnerServiceType); }