Ejemplo n.º 1
0
 public CoachingModule(
     string name,
     CoachingModuleResource introduction,
     CoachingModuleExerciseResource exercise,
     CoachingModuleExerciseResource reflection)
 {
     Name         = name;
     Description  = "";
     Peptalk      = "";
     Introduction = new CoachingModuleResourceReference(introduction.Id, introduction.RevisionHistory.ReferenceId);
     Exercise     = new CoachingModuleResourceReference(exercise.Id, exercise.RevisionHistory.ReferenceId);
     Reflection   = new CoachingModuleResourceReference(reflection.Id, reflection.RevisionHistory.ReferenceId);
 }
        /// <summary>
        /// Add the new version to the revision history by adding reference to resource
        /// </summary>
        /// <param name="newVersion"></param>
        /// <param name="resourseRepos"></param>
        public void PushVersion(CoachingModuleResource newVersion, IModuleResourceRepository resourseRepos)
        {
            var last = resourseRepos.GetItems(i => i.RevisionHistory.ReferenceId == this.Id).OrderBy(i => i.Version).LastOrDefault();

            if (last != null)
            {
                newVersion.Version = last.Version + 1;
            }
            else
            {
                newVersion.Version = 1;
            }

            newVersion.RevisionHistory = new ResourseRevisionHistoryReference()
            {
                ReferenceId = Id
            };
        }