public List <ExperienceQualifier> GetQualifiers() { RockContext rockContext = new RockContext(); ExperienceQualifierService experienceQualifierService = new ExperienceQualifierService(rockContext); var entityTypeId = EntityTypeCache.Get(this.TypeId).Id; return(experienceQualifierService.Queryable().Where(q => q.EntityTypeId == entityTypeId && q.ParentId == Id).ToList()); }
public ExperienceQualifier GetQualifier(string qualifierKey, RockContext rockContext) { ExperienceQualifierService experienceQualifierService = new ExperienceQualifierService(rockContext); var entityTypeId = EntityTypeCache.Get(this.TypeId).Id; return(experienceQualifierService.Queryable() .Where(q => q.EntityTypeId == entityTypeId && q.ParentId == Id && q.Key == qualifierKey) .FirstOrDefault()); }
public ExperienceQualifier AddQualifier(string key, string value) { RockContext rockContext = new RockContext(); ExperienceQualifierService experienceQualifierService = new ExperienceQualifierService(rockContext); var qualifier = GetQualifier(key, rockContext); if (qualifier == null) { qualifier = new ExperienceQualifier { EntityTypeId = this.TypeId, ParentId = this.Id, Key = key, }; experienceQualifierService.Add(qualifier); } qualifier.Value = value; rockContext.SaveChanges(); return(qualifier); }