Initial Commit

This commit is contained in:
2026-04-20 19:14:50 -05:00
parent f6b76d78fa
commit 4674529b91
28 changed files with 452 additions and 0 deletions
@@ -0,0 +1,40 @@
using Microsoft.AspNetCore.Mvc;
using WyvernInventory.Core.Interfaces.Services;
using WyvernInventory.Core.Models;
namespace WyvernInventory.API.Controllers;
[ApiController]
[Route("[controller]")]
public class InventoryController(IDataObjectService<GenericInventoryItem> genericItemService)
: ControllerBase
{
private readonly IDataObjectService<GenericInventoryItem> _genericItemService = genericItemService;
[HttpPost]
public List<GenericInventoryItem> Get([FromBody] List<GenericInventoryItem> items)
{
return _genericItemService.GetAsync(_ => _).Result;
}
[HttpPost("upsert")]
public IResult Post([FromBody] List<GenericInventoryItem> items)
{
(int, int) results = _genericItemService.UpsertAsync(items).Result;
if (results.Item1 > 0 || results.Item2 > 0)
{
return Results.StatusCode(201);
}
return Results.Ok();
}
[HttpDelete("{id}")]
public IResult Delete([FromRoute] int id)
{
_genericItemService.DeleteAsync(new() { new() { Id = id } }).Wait();
return Results.Ok();
}
}