using Microsoft.AspNetCore.Mvc; using Emergence.models; using Emergence.services.Interface; using Microsoft.AspNetCore.Http.HttpResults; namespace Emergence.api.Controllers; [ApiController] [Route("[controller]", Name = "Tenant", Order = 1)] public class TenantController : ControllerBase { private readonly ITenantService _tenantService; public TenantController(ITenantService tenantService) { _tenantService = tenantService; } [HttpGet(Name = "GetTenants"), ProducesResponseType(StatusCodes.Status200OK), ProducesResponseType(StatusCodes.Status404NotFound)] public async Task>, NotFound>> GetAsync() { var tenants = await _tenantService.GetAllAsync(); return tenants is IList result ? TypedResults.Ok(result) : TypedResults.NotFound(); } }