using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ZhongLianInterface;
using ZhongLianModel;
using ZhongLianService;
namespace ZhongLianAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ParamController : ControllerBase
{
public ParamController(IParamService productService) {
ProductService = productService;
}
private readonly IParamService ProductService;
///
/// 创建设备分类
///
/// 设备分类
///
[HttpPost("insert")]
public async Task Insert(ParamDO product)
{
var _CheckMSG = ProductService.InsertCheck(product);
if (string.IsNullOrEmpty(_CheckMSG))
{
return Ok(await ProductService.Insert(product));
}
else
{
return BadRequest(_CheckMSG);
}
}
///
/// 更新设备分类
///
/// 设备分类
///
[HttpPost("update")]
public async Task Update(ParamDO product)
{
var _CheckMSG = ProductService.UpdateCheck(product);
if (string.IsNullOrEmpty(_CheckMSG))
{
return Ok(await ProductService.Update(product));
}
else
{
return BadRequest(_CheckMSG);
}
}
[HttpPost("delete")]
public async Task Delete(string[] ids) {
await ProductService.Delete(ids);
return Ok();
}
[HttpPost("list")]
public async Task List(ParamDO param) {
return Ok(await ProductService.List(param));
}
}
}