using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using OSI.API.Business.Objects; using OSI.API.Business.DAO; namespace OSI.API.Controllers { [Route("api/v{version:apiVersion}/[controller]")] [ApiController] public class InvoicesController : EndpointBase { public override IActionResult Delete(int id) { return NotFound(); } public override IActionResult Get() { //> get all invoices as a list of InvoiceObjects using InvoiceDAO dao = new(new Common.Library.SQL.Base.SQLBase.DBConnectionInformation()); return new JsonResult(dao.GetAll()); } public override IActionResult Get(int id) { using InvoiceDAO dao = new(new Common.Library.SQL.Base.SQLBase.DBConnectionInformation()); return new JsonResult(dao.Get(id)); } public override IActionResult Create([FromBody] InvoiceObject input) { throw new NotImplementedException(); } public override IActionResult Update([FromBody] InvoiceObject input) { return CreatedAtAction( "Get", routeValues: new { id = input.InvoiceNumber }, value: input ); } } }