You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.1 KiB

3 years ago
using EC.App.Core;
3 years ago
using EC.App.ThatBLL.Onvif;
3 years ago
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
/// <summary>
/// Onvif 增删改查
/// </summary>
[ApiController]
3 years ago
[ApiDescriptionSettings("Onvif")]
[Route("onvif/[controller]")]
3 years ago
public class CurdController : ApiController
{
private readonly ICurdBLL _curdBLL;
/// <summary>
///
/// </summary>
/// <param name="curdBLL"></param>
public CurdController(ICurdBLL curdBLL)
{
_curdBLL = curdBLL;
}
/// <summary>
/// 添加 onvif
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="username">用户名</param>
/// <param name="password">密码</param>
/// <returns></returns>
[HttpPost]
public async Task<bool> Add(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] string username, [FromForm][Required] string password)
3 years ago
{
bool ret = await _curdBLL.Add(ip, username, password);
return ret;
}
/// <summary>
/// 移除 onvif
/// </summary>
/// <param name="ip">IP地址</param>
/// <returns></returns>
3 years ago
[HttpDelete]
3 years ago
public bool Remove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _curdBLL.Remove(ip);
return ret;
}
/// <summary>
/// 更新 onvif
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="username">用户名</param>
/// <param name="password">密码</param>
/// <returns></returns>
[HttpPost]
public async Task<bool> Update(
[FromForm][Required][DataValidation(ValidationTypes.IPv4)] string ip,
[FromForm][Required] string username, [FromForm][Required] string password)
3 years ago
{
bool ret = await _curdBLL.Update(ip, username, password);
return ret;
}
/// <summary>
/// 是否存在 onvif
/// </summary>
/// <param name="ip">IP地址</param>
/// <returns></returns>
[HttpGet]
public bool IsExist(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _curdBLL.IsExist(ip);
return ret;
}
}
}