DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/TelemetryController.cs
2021-04-07 18:01:56 +05:00

52 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers
{
/// <summary>
/// Контроллер сбора данных от буровых
/// </summary>
[Route("api/telemetry")]
[ApiController]
public class TelemetryController : ControllerBase
{
private readonly ITelemetryService telemetryService;
public TelemetryController(ITelemetryService telemetryService)
{
this.telemetryService = telemetryService;
}
/// <summary>
/// Принимает общую информацию по скважине
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("{uid}/info")]
public IActionResult Info(string uid, [FromBody] TelemetryInfoDto info)
{
telemetryService.UpdateInfo(uid, info);
return Ok();
}
/// <summary>
/// Принимает данные от разных систем по скважине
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("{uid}/data")]
public IActionResult Data(string uid, [FromBody] TelemetryDataDto data)
{
telemetryService.UpdateData(uid, data);
return Ok();
}
}
}