public IActionResult Index() { var user = User.Identity.Name; var favorites = repo.GetAllFavorites(user); return(View(favorites)); }
public IActionResult SearchArtPosts(int userId, int CategoryCriterion, int ArtTypeCriterion, bool latestSwitch, bool trendingSwitch, bool followingSwitch) { if (followingSwitch == true) { List <Favorite> favorites = new List <Favorite>(); List <Following> follows = _followingRepository.GetAllFollows(userId); return(Ok(_artPostRepository.SearchArtPosts(CategoryCriterion, ArtTypeCriterion, latestSwitch, trendingSwitch, follows, favorites))); } else if (latestSwitch == false && trendingSwitch == false && followingSwitch == false) { List <Favorite> favorites = _favoritesRepository.GetAllFavorites(userId); List <Following> follows = new List <Following>(); return(Ok(_artPostRepository.SearchArtPosts(CategoryCriterion, ArtTypeCriterion, latestSwitch, trendingSwitch, follows, favorites))); } else { List <Favorite> favorites = new List <Favorite>(); List <Following> follows = new List <Following>(); return(Ok(_artPostRepository.SearchArtPosts(CategoryCriterion, ArtTypeCriterion, latestSwitch, trendingSwitch, follows, favorites))); } }
public IEnumerable <Favorite> GetAllFavorites() { try { return(_favRepo.GetAllFavorites()); } catch (Exception ex) { throw ex; } }
public IActionResult GetAllFavorites(int id) { return(Ok(_favoritesRepository.GetAllFavorites(id))); }
// GET: /<controller>/ public IActionResult Index() { var favorites = repo.GetAllFavorites(); return(View(favorites)); }