Files
inventario/backend/src/Inventario.Api/Controllers/InventoryMovementsController.cs
T
Nurfog 438077ed85 feat: add inventory management system with product, category, and movement tracking
- Implemented global styles using Tailwind CSS for consistent theming.
- Created layout component to structure the application with a navigation bar.
- Developed Movements page to handle inventory entries and exits, including form submission and data display.
- Added Products page for listing, editing, and deleting products with API integration.
- Introduced Categories management functionality.
- Built Navbar component for easy navigation across the application.
- Established API service for handling requests to the backend.
- Defined TypeScript types for Category, Product, and InventoryMovement to ensure type safety.
- Configured TypeScript settings for the project.
2026-06-25 10:26:37 -04:00

39 lines
1.1 KiB
C#

using Inventario.Core.Interfaces;
using Inventario.Core.Models;
using Microsoft.AspNetCore.Mvc;
namespace Inventario.Api.Controllers;
[ApiController]
[Route("api/[controller]")]
public class InventoryMovementsController : ControllerBase
{
private readonly IInventoryMovementRepository _repository;
public InventoryMovementsController(IInventoryMovementRepository repository)
{
_repository = repository;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<InventoryMovement>>> GetAll()
{
var movements = await _repository.GetAllAsync();
return Ok(movements);
}
[HttpGet("product/{productId}")]
public async Task<ActionResult<IEnumerable<InventoryMovement>>> GetByProduct(int productId)
{
var movements = await _repository.GetByProductIdAsync(productId);
return Ok(movements);
}
[HttpPost]
public async Task<ActionResult<InventoryMovement>> Create(InventoryMovement movement)
{
var created = await _repository.AddAsync(movement);
return CreatedAtAction(nameof(GetByProduct), new { productId = created.ProductId }, created);
}
}