iScraper/Controllers/ScraperController.cs

49 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ViraScraper.Repositories;
using ViraScraper.Repositories.Contracts;
using ViraScraper.Services.Contracts;
namespace ViraScraper.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ScraperController : ControllerBase
{
private readonly IServiceWrapper _serviceWrapper;
public ScraperController(IServiceWrapper serviceWrapper)
{
_serviceWrapper = serviceWrapper;
}
[HttpGet()]
public async Task<IActionResult> GetScrape()
{
try
{
return Ok(await _serviceWrapper.HashtagService.GetHshtags("باران"));
return Ok();
}
catch (Exception e)
{
return BadRequest(e.Message);
}
}
/*[HttpGet]
public async Task<IActionResult> GetScrape(string hashtag)
{
try
{
return Ok(await _serviceWrapper.HashtagService.GetHshtags(hashtag));
}
catch (Exception e)
{
return BadRequest(e.Message);
}
}*/
}
}