/// <summary>
        /// Bookmark new item
        /// </summary>
        /// <param name="entity">The item</param>
        public void Add(GenericItemEntity entity)
        {
            if (string.IsNullOrEmpty(entity.Id))
            {
                return;
            }

            var item = this.database.GetItem(entity.Id);

            if (item != null)
            {
                service.Bookmark(item);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute the command - bookmarkd or un-bookmark the page
        /// </summary>
        /// <param name="context">The context</param>
        public override void Execute(CommandContext context)
        {
            var contextItem = context.Items.FirstOrDefault();

            if (contextItem == null)
            {
                return;
            }

            if (!service.CheckUser())
            {
                return;
            }

            if (service.IsBookmarked(contextItem))
            {
                service.UnBookmark(contextItem);
            }
            else
            {
                service.Bookmark(contextItem);
            }
        }