using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PARR.API.Contracts.V1;
using PARR.API.Contracts.V1.Responses;
using PARR.API.Contracts.V1.Responses.Base;
using PARR.API.Controllers.V1.Base;
using PARR.DAL.Services.Interfaces;
namespace PARR.API.Controllers.V1
{
public class TaskStatusController : BaseApiController
{
private readonly IMapper mapper;
private readonly IStatusTemplateService statusTemplateService;
public TaskStatusController(
IMapper mapper,
IStatusTemplateService statusTemplateService
)
{
this.mapper = mapper;
this.statusTemplateService = statusTemplateService;
}
///
/// Получить список статусов заданий
///
///
[HttpGet(ApiRoutes.TaskStatus.GetAll)]
public async Task GetAll()
{
var statusList = await statusTemplateService.Get()
.OrderBy(t => t.Code)
.ToListAsync();
var response = mapper.Map>(statusList);
return Ok(new Response>(response, true));
}
}
}