props/Props/Controllers/SearchController.cs

38 lines
1.1 KiB
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Props.Models.Search;
using Props.Services.Modules;
using Props.Shop.Framework;
namespace Props.Controllers
{
2021-07-24 07:32:30 +00:00
public class SearchController : ApiControllerBase
{
private SearchOutline defaultOutline = new SearchOutline();
ISearchManager searchManager;
public SearchController(ISearchManager searchManager)
{
this.searchManager = searchManager;
}
[HttpGet]
[Route("AvailableShops")]
public async Task<IActionResult> GetAvailableShops()
{
return Ok(await searchManager.ShopManager.GetAllShopNames());
}
[HttpGet]
[Route("SearchShops/{search}/")]
public async Task<IActionResult> GetSearch(string searchQuery, [FromQuery] SearchOutline searchOutline)
{
if (searchQuery == null) return BadRequest();
return Ok(await searchManager.Search(searchQuery, searchOutline));
}
}
}