Updated Controller structuring.
This commit is contained in:
		
							
								
								
									
										11
									
								
								Props/Controllers/ApiControllerBase.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Props/Controllers/ApiControllerBase.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace Props.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [ApiController]
 | 
			
		||||
    [Route("api/[Controller]")]
 | 
			
		||||
    public class ApiControllerBase : ControllerBase
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -4,9 +4,7 @@ using Props.Services.Modules;
 | 
			
		||||
 | 
			
		||||
namespace Props.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [ApiController]
 | 
			
		||||
    [Route("api/[Controller]")]
 | 
			
		||||
    public class SearchController : ControllerBase
 | 
			
		||||
    public class SearchController : ApiControllerBase
 | 
			
		||||
    {
 | 
			
		||||
        private SearchOutline defaultOutline = new SearchOutline();
 | 
			
		||||
        IShopManager shopManager;
 | 
			
		||||
@@ -23,16 +21,15 @@ namespace Props.Controllers
 | 
			
		||||
            return Ok(shopManager.AvailableShops());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [HttpGet]
 | 
			
		||||
        [Route("Default/Outline/Filters")]
 | 
			
		||||
        [Route("Default/Filters")]
 | 
			
		||||
        public IActionResult GetDefaultFilters()
 | 
			
		||||
        {
 | 
			
		||||
            return Ok(defaultOutline.Filters);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpGet]
 | 
			
		||||
        [Route("Default/Outline/DisabledShops")]
 | 
			
		||||
        [Route("Default/DisabledShops")]
 | 
			
		||||
        public IActionResult GetDefaultDisabledShops()
 | 
			
		||||
        {
 | 
			
		||||
            return Ok(defaultOutline.Disabled);
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ let inputs = {
 | 
			
		||||
 | 
			
		||||
async function main() {
 | 
			
		||||
    setupInteractiveBehavior();
 | 
			
		||||
    await setupInitialValues((await apiHttp.get("/Search/Default/Outline/Filters")).data);
 | 
			
		||||
    await setupInitialValues((await apiHttp.get("/Search/Default/Filters")).data);
 | 
			
		||||
    await setupShopToggles((await apiHttp.get("/Search/Shops/Available")).data);
 | 
			
		||||
 | 
			
		||||
    document.querySelector("#configuration .invisible").classList.remove("invisible"); // Load completed, show the UI.
 | 
			
		||||
@@ -88,7 +88,7 @@ async function setupInitialValues(filters) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function setupShopToggles(availableShops) {
 | 
			
		||||
    let disabledShops = (await apiHttp.get("/Search/Default/Outline/DisabledShops")).data;
 | 
			
		||||
    let disabledShops = (await apiHttp.get("/Search/Default/DisabledShops")).data;
 | 
			
		||||
    let shopsElem = document.getElementById("shop-checkboxes");
 | 
			
		||||
    availableShops.forEach(shopName => {
 | 
			
		||||
        let id = `${shopName}-enabled`;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user