You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OSI-API/OSI-API/Controllers/InvoicesController.cs

49 lines
1.4 KiB
C#

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<InvoiceObject>
{
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
);
}
}
}