38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
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
|
|
{
|
|
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));
|
|
}
|
|
}
|
|
} |