Esempio n. 1
0
        public ActionResult Favorite(int articleId)
        {
            if (DataRepository.GetArticle(articleId) == null)
                return RedirectToAction("Details", "Articles", new {id = articleId});

            var curAppUserId = User.Identity.GetUserId();
            Favorite fav = new Favorite()
            {
                ArticleId = articleId,
                UserId = curAppUserId,
                AdditionDate = DateTime.Now
            };
            if (UsersRepository.FindFavorite(articleId, curAppUserId) == null)
                UsersRepository.AddFavorite(fav);
            return RedirectToAction("Details", "Articles", new { id = articleId });
        }
Esempio n. 2
0
 public void AddFavorite(Favorite favorite)
 {
     QueryExecutor.Instance.AddFavorite(favorite);
 }
 public void AddFavorite(Favorite favorite)
 {
     Favorites.Add(favorite);
 }