You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
3 months ago
|
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<ActionResult<Explore>> 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;
|
||
|
}
|
||
|
}
|
||
|
}
|