forked from ddrilling/AsbCloudServer
55 lines
1.5 KiB
C#
55 lines
1.5 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/[controller]")]
|
|||
|
[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 Get()
|
|||
|
{
|
|||
|
var claimIdCustomer = User.FindFirst("IdCustomer");
|
|||
|
|
|||
|
if (claimIdCustomer is null)
|
|||
|
return NoContent();
|
|||
|
|
|||
|
var idCustomer = int.Parse(claimIdCustomer.Value);
|
|||
|
|
|||
|
var wells = wellService.GetWellsByCustomer(idCustomer);
|
|||
|
|
|||
|
return Ok(wells);
|
|||
|
}
|
|||
|
|
|||
|
//[Route("{id}")]
|
|||
|
//[HttpGet]
|
|||
|
//[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
|||
|
//public IActionResult GetByCustomer(int id)
|
|||
|
//{
|
|||
|
// var claimIdCustomer = User.FindFirst("IdCustomer");
|
|||
|
|
|||
|
// if (claimIdCustomer is null)
|
|||
|
// return NoContent();
|
|||
|
|
|||
|
// var idCustomer = int.Parse(claimIdCustomer.Value);
|
|||
|
|
|||
|
// var wells = wellService.GetWellsByCustomer(idCustomer);
|
|||
|
|
|||
|
// return Ok(wells);
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|