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

71 lines
1.9 KiB
C#

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;
/// <summary>
/// 创建设备分类
/// </summary>
/// <param name="product">设备分类</param>
/// <returns></returns>
[HttpPost("insert")]
public async Task<ActionResult> Insert(ParamDO product)
{
var _CheckMSG = ProductService.InsertCheck(product);
if (string.IsNullOrEmpty(_CheckMSG))
{
return Ok(await ProductService.Insert(product));
}
else
{
return BadRequest(_CheckMSG);
}
}
/// <summary>
/// 更新设备分类
/// </summary>
/// <param name="product">设备分类</param>
/// <returns></returns>
[HttpPost("update")]
public async Task<ActionResult> 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<ActionResult> Delete(string[] ids) {
await ProductService.Delete(ids);
return Ok();
}
[HttpPost("list")]
public async Task<ActionResult> List(ParamDO param) {
return Ok(await ProductService.List(param));
}
}
}