Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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);
        }