protected TopicViewModelBase( IPubsubSourceRootViewModel owner, ITopicItem item, IEnumerable <Subscription> subscriptions) { Owner = owner; Item = item; Caption = Item.DisplayName; AddSubscriptonsOfTopic(subscriptions); }
/// <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); }
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); }
public void RemoveFromITopicItem(ITopicItem entity) { var objFromDb = _db.Topic.FirstOrDefault(x => x.ObjectId == entity.Id && x.TopicType == entity.TopicType); dbSet.Remove(objFromDb); }
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) { }