protected TopicViewModelBase(
     IPubsubSourceRootViewModel owner,
     ITopicItem item,
     IEnumerable <Subscription> subscriptions)
 {
     Owner   = owner;
     Item    = item;
     Caption = Item.DisplayName;
     AddSubscriptonsOfTopic(subscriptions);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a topic object from an ITopicItem entity.
        /// </summary>
        /// <param name="entity">A class that inherits from ITopicItem</param>
        /// <returns>The new Topic object</returns>
        public Topic AddFromITopicItem(ITopicItem entity)
        {
            Topic topic = new Topic();

            topic.Name      = entity.Name;
            topic.ObjectId  = entity.Id;
            topic.TopicType = entity.TopicType;
            base.Add(topic);
            return(topic);
        }
Exemplo n.º 3
0
        public void UpdateFromITopicItem(ITopicItem entity)
        {
            var objFromDb = _db.Topic.FirstOrDefault(x => x.ObjectId == entity.Id && x.TopicType == entity.TopicType);

            if (objFromDb == null)
            {
                throw new SafeException(Models.Enums.ErrorType.AnErrorOccurred, new Exception(string.Format("ITopicItem not found ObjectId {0} TopicType {1}", entity.Id, entity.TopicType)));
            }

            objFromDb.Name = entity.Name;
            dbSet.Update(objFromDb);
        }
Exemplo n.º 4
0
        public void RemoveFromITopicItem(ITopicItem entity)
        {
            var objFromDb = _db.Topic.FirstOrDefault(x => x.ObjectId == entity.Id && x.TopicType == entity.TopicType);

            dbSet.Remove(objFromDb);
        }
Exemplo n.º 5
0
 public Topic FirstOrDefaultFromITopicItem(ITopicItem entity)
 {
     return(_db.Topic.FirstOrDefault(x => x.ObjectId == entity.Id && x.TopicType == entity.TopicType));
 }
 public TestTopicViewModelBase(
     IPubsubSourceRootViewModel owner,
     ITopicItem item,
     IEnumerable <Subscription> subscriptions) : base(owner, item, subscriptions)
 {
 }