Initial
This commit is contained in:
		
							
								
								
									
										57
									
								
								SearchWebApi/Controllers/LookupController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								SearchWebApi/Controllers/LookupController.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| using BusinessLogic.LookupLogic.Interfaces; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace FwSearchApi.Controllers | ||||
| { | ||||
|     [ApiController] | ||||
|     [Route("[controller]")] | ||||
|     public class LookupController : ControllerBase | ||||
|     { | ||||
|         private readonly IConfiguration _configuration; | ||||
|         private readonly ILogger<LookupController> _logger; | ||||
|         private readonly ILookupLogic _lookupLogic; | ||||
|  | ||||
|         public LookupController(IConfiguration configuration, ILogger<LookupController> logger, ILookupLogic lookupLogic) | ||||
|         { | ||||
|             _configuration = configuration; | ||||
|             _logger = logger; | ||||
|             _lookupLogic = lookupLogic; | ||||
|         } | ||||
|  | ||||
|         [HttpGet] | ||||
|         [Route("GetAllLookups")] | ||||
|         public async Task<JsonResult> GetAllLookups() | ||||
|         { | ||||
|             var result = await _lookupLogic.GetAllLookups(); | ||||
|             _logger.LogInformation($"Lookups zur Verf<72>gung gestellt von {nameof(GetAllLookups)}"); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|  | ||||
|         [HttpGet] | ||||
|         [Route("GetCategoriesById")] | ||||
|         public async Task<JsonResult> GetLookupCategoriesById(long id) | ||||
|         { | ||||
|             var result = await _lookupLogic.GetLookupCategoryById(id); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|  | ||||
|         [HttpGet] | ||||
|         [Route("GetCategoriesByName")] | ||||
|         public async Task<JsonResult> GetLookupCategoriesByName(string categoryName) | ||||
|         { | ||||
|             var result = await _lookupLogic.GetLookupCategoryByName(categoryName); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|  | ||||
|         [HttpGet] | ||||
|         [Route("GetActiveCategories")] | ||||
|         public async Task<JsonResult> GetActiveLookupCategories() | ||||
|         { | ||||
|             var result = await _lookupLogic.GetActiveLookupCategories(); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|     } | ||||
| }  | ||||
							
								
								
									
										46
									
								
								SearchWebApi/Controllers/SearchController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								SearchWebApi/Controllers/SearchController.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using System.Threading.Tasks; | ||||
| using SearchLogic; | ||||
| using Datamodels.SearchModels; | ||||
| using System.Collections.Generic; | ||||
| using Datamodels.DatabaseModels; | ||||
|  | ||||
| namespace FwSearchApi.Controllers | ||||
| { | ||||
|     [ApiController] | ||||
|     [Route("[controller]")] | ||||
|     public class SearchController : ControllerBase | ||||
|     { | ||||
|         private readonly ILogger<SearchController> _logger; | ||||
|         private readonly IConfiguration _configuration; | ||||
|         private readonly ISearchLogic _searchLogic; | ||||
|  | ||||
|         public SearchController(ILogger<SearchController> logger, IConfiguration configuration, ISearchLogic searchLogic) | ||||
|         { | ||||
|             _logger = logger; | ||||
|             _configuration = configuration; | ||||
|             _searchLogic = searchLogic; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// This is for Test only | ||||
|         /// </summary> | ||||
|         [HttpGet] | ||||
|         [Route("GetAddresses")] | ||||
|         public async Task<JsonResult> GetAllAddresses() | ||||
|         { | ||||
|             var result = await _searchLogic.GetAllAddresses(); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|  | ||||
|         [HttpPost] | ||||
|         [Route("GetFilteredData")] | ||||
|         public async Task<JsonResult> GetFilteredData([FromBody] FilterModel filter, [FromQuery] long skip = 0, [FromQuery] long take = -1) | ||||
|         { | ||||
|             var result = await _searchLogic.GetFilteredData(filter, skip, take); | ||||
|             return new JsonResult(result); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										39
									
								
								SearchWebApi/Controllers/WeatherForecastController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								SearchWebApi/Controllers/WeatherForecastController.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace FeatureWerkAPIs.Controllers | ||||
| { | ||||
|     [ApiController] | ||||
|     [Route("[controller]")] | ||||
|     public class WeatherForecastController : ControllerBase | ||||
|     { | ||||
|         private static readonly string[] Summaries = new[] | ||||
|         { | ||||
|             "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||||
|         }; | ||||
|  | ||||
|         private readonly ILogger<WeatherForecastController> _logger; | ||||
|  | ||||
|         public WeatherForecastController(ILogger<WeatherForecastController> logger) | ||||
|         { | ||||
|             _logger = logger; | ||||
|         } | ||||
|  | ||||
|         [HttpGet] | ||||
|         public IEnumerable<WeatherForecast> Get() | ||||
|         { | ||||
|             var rng = new Random(); | ||||
|             return Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||||
|             { | ||||
|                 Date = DateTime.Now.AddDays(index), | ||||
|                 TemperatureC = rng.Next(-20, 55), | ||||
|                 Summary = Summaries[rng.Next(Summaries.Length)] | ||||
|             }) | ||||
|             .ToArray(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user