forked from ddrilling/AsbCloudServer
55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AsbCloudWebApi.Controllers
|
|
{
|
|
[Route("api/well")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class WellController : ControllerBase
|
|
{
|
|
private readonly IWellService wellService;
|
|
|
|
public WellController(IWellService wellService)
|
|
{
|
|
this.wellService = wellService;
|
|
}
|
|
|
|
[HttpGet]
|
|
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
public IActionResult GetWells()
|
|
{
|
|
var idCustomer = User.GetCustomerId();
|
|
|
|
if (idCustomer is null)
|
|
{
|
|
return NoContent();
|
|
}
|
|
|
|
var wells = wellService.GetWellsByCustomer((int)idCustomer);
|
|
|
|
return Ok(wells);
|
|
}
|
|
|
|
[HttpGet("transmittingWells")]
|
|
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
public IActionResult GetTransmittingWells()
|
|
{
|
|
var idCustomer = User.GetCustomerId();
|
|
|
|
if(idCustomer is null)
|
|
{
|
|
return NoContent();
|
|
}
|
|
|
|
var transmittingWells = wellService.GetTransmittingWells((int)idCustomer);
|
|
|
|
return Ok(transmittingWells);
|
|
|
|
}
|
|
}
|
|
}
|