2021-08-17 07:59:01 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Net;
|
|
|
|
using System.Threading.Tasks;
|
2021-07-22 21:12:27 +00:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Props.Models.Search;
|
|
|
|
using Props.Services.Modules;
|
2021-08-17 07:59:01 +00:00
|
|
|
using Props.Shop.Framework;
|
2021-07-22 21:12:27 +00:00
|
|
|
|
|
|
|
namespace Props.Controllers
|
|
|
|
{
|
2021-07-24 07:32:30 +00:00
|
|
|
public class SearchController : ApiControllerBase
|
2021-07-22 21:12:27 +00:00
|
|
|
{
|
|
|
|
private SearchOutline defaultOutline = new SearchOutline();
|
2021-08-17 07:59:01 +00:00
|
|
|
ISearchManager searchManager;
|
2021-07-22 21:12:27 +00:00
|
|
|
|
2021-08-17 07:59:01 +00:00
|
|
|
public SearchController(ISearchManager searchManager)
|
2021-07-22 21:12:27 +00:00
|
|
|
{
|
2021-08-17 07:59:01 +00:00
|
|
|
this.searchManager = searchManager;
|
2021-07-22 21:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[HttpGet]
|
2021-08-17 07:59:01 +00:00
|
|
|
[Route("AvailableShops")]
|
|
|
|
public async Task<IActionResult> GetAvailableShops()
|
2021-07-22 21:12:27 +00:00
|
|
|
{
|
2021-08-17 07:59:01 +00:00
|
|
|
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));
|
2021-07-22 21:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|