using Google.Apis.Auth.OAuth2; using Google.Cloud.Firestore; using Grpc.Auth; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Teso_API.Models; namespace Teso_API.Controllers { [AllowAnonymous, Route("explore")] [ApiController] public class ExploreController : ControllerBase { private readonly TESOContext _context; public ExploreController(TESOContext context) { _context = context; } [Authorize] [Route("main"), HttpGet] public async Task> GetTrending() { Explore explore = new Explore(); explore.latest = await _context.Products.FromSqlRaw("exec [dbo].[usp_latest_products_get]").ToListAsync(); explore.trending = await _context.Products.FromSqlRaw("exec [dbo].[usp_trending_products_get]").ToListAsync(); return explore; } } }