Files
CartriX/CartriX.Api/Controllers/LocationController.cs
T

31 lines
839 B
C#

using CartriX.Api.Interfaces;
using CartriX.Api.Services;
using CartriX.Shared.Classes;
using CartriX.Shared.Mappers;
using CartriX.Shared.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace CartriX.Api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class LocationController : ControllerBase
{
private readonly ILocationService _locationService;
public LocationController(ILocationService locationService)
{
_locationService = locationService;
}
[HttpGet("GetAll")]
public IActionResult GetAll()
{
var result = _locationService.GetAll().Result;
var converted = result.Select(l => l.ToQueryToListLocationsAndPrintersDto());
return Ok(converted);
}
}
}