Пример #1
0
        internal void SaveUserCreated(Person person)
        {
            RockContext       rockContext       = new RockContext();
            ExperienceService experienceService = new ExperienceService(rockContext);

            var verb = xAPI.Utilities.VerbHelper.GetOrCreateVerb("http://activitystrea.ms/schema/1.0/join");

            var experience = new Experience
            {
                PersonAliasId = person.PrimaryAliasId ?? 0,
                VerbValueId   = verb.Id,
                xObject       = new ExperienceObject
                {
                    EntityTypeId = EntityTypeCache.Get(typeof(xAPIComponent)).Id,
                    ObjectId     = EntityTypeCache.Get(typeof(RiseComponent)).Id.ToString()
                },
                Result = new ExperienceResult
                {
                    WasSuccess = true,
                    IsComplete = true
                }
            };

            experienceService.Add(experience);
            rockContext.SaveChanges();

            var context     = experience.AddQualifier("context");
            var experiences = context.AddQualifier("experiences");

            experiences.AddQualifier(
                xAPI.Utilities.ExtensionHelper.GetOrCreateExtension("http://id.tincanapi.com/extension/datetime"),
                RockDateTime.Now.ToString());
        }