using Expose.MyIT.Shared.Models.Stateless; using Microsoft.AspNetCore.Mvc; namespace Expose.MyIT.Server.Controllers; [ApiController] [Route("api/[controller]")] public class SsaOrderController : ControllerBase, ISsaOrderController { private readonly ISsaOrderRepository _SsaOrderRepository; public SsaOrderController(ISsaOrderRepository SsaOrderRepository) => _SsaOrderRepository = SsaOrderRepository; [HttpGet(nameof(ISsaOrderController.Action.All))] public async Task GetAllSsaOrders() { try { Shared.ViewModels.SsaOrder[] results = await _SsaOrderRepository.GetAllSsaOrders(); return Ok(results); } catch (Exception) { return StatusCode(StatusCodes.Status500InternalServerError, "Error retrieving data from the database"); } } [HttpGet] [Route("{id}")] public async Task GetSsaOrders(string id) { try { Shared.ViewModels.SsaOrder[] results = await _SsaOrderRepository.GetSsaOrders(id); return Ok(results); } catch (Exception) { return StatusCode(StatusCodes.Status500InternalServerError, "Error retrieving data from the database"); } } }