/// <summary>
        /// Populates the view ViewModel.
        /// </summary>
        /// <returns>
        /// </returns>
        public override void PopulateViewModel()
        {
            BookMarkObject = DV.BookMarkDV.GetModelFromHLinkString(BaseNavParamsHLink.HLinkKey);

            if (BookMarkObject != null)
            {
                BaseTitle     = BookMarkObject.GetDefaultText;
                BaseTitleIcon = CommonConstants.IconBookMark;

                // Get basic details
                CardGroup t = new CardGroup {
                    Title = "Header Details"
                };

                t.Cards.Add(new CardListLineCollection
                {
                    new CardListLine("Card Type:", "BookMark Detail"),
                    new CardListLine("Private:", BookMarkObject.PrivAsString),
                    new CardListLine("Target:", BookMarkObject.GTarget),
                });

                // Add Model details
                t.Cards.Add(DV.BookMarkDV.GetModelInfoFormatted(BookMarkObject));

                BaseHeader.Add(t);

                BaseBackLinks.Add(BookMarkObject.BackHLinkReferenceCollection.GetCardGroup());
            }
        }
Exemple #2
0
        public IActionResult CreateBookmark(BookMarkModel bookmarkModel)
        {
            if (bookmarkModel == null)
            {
                return(BadRequest("null"));
            }
            bool check = _bookmarkLogic.CreateNewBookMark(bookmarkModel);

            if (!check)
            {
                return(BadRequest("Cannot create a new bookmark"));
            }
            return(Ok("Success"));
        }
Exemple #3
0
        public bool CreateNewBookMark(BookMarkModel bookMark)
        {
            bool check = false;

            if (bookMark != null)
            {
                Bookmark bookmark = new Bookmark()
                {
                    UserId = bookMark.UserId,
                    NewsId = bookMark.NewsId,
                };
                _unitOfWork.GetRepository <Bookmark>().Insert(bookmark);
                _unitOfWork.Commit();
                check = true;
            }
            return(check);
        }
Exemple #4
0
        private void savedBookMark()
        {
            BookMarkModel lBookMarkModel = new BookMarkModel();

            lBookMarkModel.title       = mArticle.title;
            lBookMarkModel.author      = mArticle.author;
            lBookMarkModel.urlToImage  = mArticle.urlToImage;
            lBookMarkModel.content     = mArticle.content;
            lBookMarkModel.description = mArticle.description;
            lBookMarkModel.publishedAt = mArticle.publishedAt;

            //TODO Need to add all items
            int results = conn.Insert(lBookMarkModel); // TO SEND

            if (results > 0)
            {
                App.Current.MainPage.DisplayAlert("BookMark", "Book mark items saved successfully", "Ok");
            }
            else
            {
                App.Current.MainPage.DisplayAlert("Bookmark", "Bookmark Saved failed, Could you please try again", "OK");
            }
        }