Beispiel #1
0
        /// <summary>
        /// Adds the update story.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="content">The content.</param>
        /// <returns>ItemContent.</returns>
        public ItemContent AddUpdateStory(Category category, ItemContent content)
        {
            var _content = db.ItemContents.SingleOrDefault(s =>
                                                           s.Title == content.Title && s.CreatedBy == content.CreatedBy);

            if (_content != null)
            {
                return(_content);
            }
            db.ItemContents.Add(content);
            db.SaveChanges();
            return(content);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Item"/> class.
 /// </summary>
 /// <param name="category">The category.</param>
 /// <param name="content">The content.</param>
 public Item(Category category, ItemContent content)
 {
     this.Category    = category;
     this.ItemContent = content;
 }
Beispiel #3
0
 /// <summary>
 /// Resets this instance.
 /// </summary>
 public Item Reset()
 {
     this.Category    = null;
     this.ItemContent = null;
     return(this);
 }
Beispiel #4
0
        /// <summary>
        /// Maps the item.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="content">The content.</param>
        /// <returns>Item.</returns>
        public static Item MapItem(Category category, ItemContent content)
        {
            var item = new Item(category, content);

            return(AutoMapper.Mapper.Map <Item>(item).Reset());
        }