Infrastructure/OpenAuth.WebApi/Controllers/ServiceControllers/IdleWatersController.cs

64 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers
{
/// <summary>
/// 水域
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class IdleWatersController : ControllerBase
{
private readonly IdleWatersApp _app;
public IdleWatersController(IdleWatersApp app)
{
_app = app;
}
#region 查询
#region 分页
/// <summary>
/// 分页
/// </summary>
[HttpGet]
public async Task<Response<PageInfo<List<IdleWaters>>>> LoadPage([FromQuery] PageReq request)
{
return await _app.LoadPage(request);
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public async Task<Response<IdleWaters>> Detail(string id)
{
var result = new Response<IdleWaters>();
try
{
result.Result = await _app.Detail(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
#endregion
#endregion
}
}