Esempio n. 1
0
        public void AddChild(SurveyObjectBase item)
        {
            var child = item as Answer;

            if (item != null)
            {
                Answers.Add((Answer)item);
                item.Parent = this;
            }
            else
            {
                throw new Exception($"Item with type {item.GetType().Name} cannot be child of type Question");
            }
        }
Esempio n. 2
0
 public void AddChild(SurveyObjectBase item)
 {
     Surveys.Add((Survey)item);
     item.Parent = this;
     ((Survey)item).UserCreator = currentUser;
 }
Esempio n. 3
0
 /// <summary>
 /// Add object to parent item
 /// </summary>
 /// <remarks>
 /// Doesn't check Id !!!!
 /// </remarks>
 /// <typeparam name="T">SurveyObjectBase</typeparam>
 /// <param name="item">Item to add</param>
 /// <param name="parent">Container item</param>
 /// <returns></returns>
 public T Add <T>(SurveyObjectBase item, IParentable parent) where T : SurveyObjectBase
 {
     parent.AddChild(item);
     return((T)item);
 }