DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/AdminTelemetryController.cs
ngfrolov 4db67113b4 CrudService очищен от неиспользуемого кода.
CrudCacheService Адаптировано для новой схемы кеширования.
Убраны extention методы для mapster.
2022-06-06 15:43:47 +05:00

39 lines
1.2 KiB
C#

using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers
{
[Route("api/admin/telemetry")]
[ApiController]
[Authorize]
public class AdminTelemetryController : CrudController<TelemetryDto, ICrudService<TelemetryDto>>
{
private readonly ITelemetryService telemetryService;
public AdminTelemetryController(ICrudService<TelemetryDto> service,
ITelemetryService telemetryService)
: base(service)
{
this.telemetryService = telemetryService;
}
/// <summary>
/// Merge telemetries. No body required.
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("/merge/{idFrom}/{idTo}")]
[Permission]
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token = default)
{
var count = await telemetryService.MergeAsync(idFrom, idTo, token)
.ConfigureAwait(false);
return Ok(count);
}
}
}