72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
|
|
using LY.App.Model;
|
|||
|
|
using LY.App.Service;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using System.Drawing.Printing;
|
|||
|
|
|
|||
|
|
namespace LY.App.Controllers
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// WhitListController
|
|||
|
|
/// </summary>
|
|||
|
|
[Route("api/[controller]")]
|
|||
|
|
[ApiController]
|
|||
|
|
public class WhitListController : ControllerBase
|
|||
|
|
{
|
|||
|
|
private readonly WhitListService _whitListService;
|
|||
|
|
/// <summary>
|
|||
|
|
/// Constructor
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="whitListService"></param>
|
|||
|
|
public WhitListController(WhitListService whitListService)
|
|||
|
|
{
|
|||
|
|
_whitListService = whitListService;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// GetList
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="pageNum"></param>
|
|||
|
|
/// <param name="pageSize"></param>
|
|||
|
|
/// <param name="key"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
public async Task<IActionResult> List(int pageNum, int pageSize, string key)
|
|||
|
|
{
|
|||
|
|
var result = await _whitListService.GetList(pageNum, pageSize, key);
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Add
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="input"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost("add")]
|
|||
|
|
public async Task<IActionResult> add(AddWhitelist input)
|
|||
|
|
{
|
|||
|
|
var result = await _whitListService.Add(input);
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Delete
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("delete")]
|
|||
|
|
public async Task<IActionResult> delete(long id)
|
|||
|
|
{
|
|||
|
|
var result = await _whitListService.Delete(id);
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// update
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost("update")]
|
|||
|
|
public async Task<IActionResult> Update(UpdateWhitelist input)
|
|||
|
|
{
|
|||
|
|
var result = await _whitListService.Update(input);
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|