Files
FA_WEB/FaKrosnoApi/Controllers/WzRowMeyleController.cs

29 lines
820 B
C#

using Microsoft.AspNetCore.Mvc;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Services;
namespace FaKrosnoApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class WzRowMeyleController(IWzRowMeyleService service) : Controller
{
[HttpGet]
public async Task<ActionResult<IEnumerable<WzRowMeyleDto>>> GetAll()
{
IEnumerable<WzRowMeyleDto> wzRows = await service.GetAll();
return Ok(wzRows);
}
[HttpPost]
public async Task<ActionResult> CreateRows([FromBody] IEnumerable<WzRowMeyleDto> rows)
{
if (rows == null || !rows.Any())
{
return BadRequest("No rows provided.");
}
await service.CreateRows(rows);
return CreatedAtAction(nameof(GetAll), new { count = rows.Count() }, rows);
}
}