Ejemplo n.º 1
0
        public static bool OnFavoriteAnnouncements(int announcementId)
        {
            var service = new FavoritesService();

            if (service.IsAnnouncementAlreadyInFavorites(Auth.user().Id, announcementId))
            {
                service.RemoveAnnouncement(Auth.user().Id, announcementId);
            }
            else
            {
                service.AddAnnouncement(Auth.user().Id, announcementId);
            }

            return(true);
        }