using CommonModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ZhongLianInterface;
using ZhongLianModel;
using ZhongLianService;
namespace ZhongLianAPI.Controllers
{
///
/// 安装单接口
///
[Route("api/[controller]")]
[ApiController]
public class InstallController : ControllerBase
{
public InstallController(IInstallService installService)
{
InstallService = installService;
}
private readonly IInstallService InstallService;
///
/// 创建安装单
///
/// 安装单
///
[HttpPost("insert")]
public async Task Insert(InstallDO install)
{
var _CheckMSG = InstallService.InsertCheck(install);
if (string.IsNullOrEmpty(_CheckMSG))
{
return Ok(await InstallService.Insert(install));
}
else
{
return BadRequest(_CheckMSG);
}
}
///
/// 更新安装单
///
/// 安装单
///
[HttpPost("update")]
public async Task Update(InstallDO install)
{
var _CheckMSG = InstallService.UpdateCheck(install);
if (string.IsNullOrEmpty(_CheckMSG))
{
return Ok(await InstallService.Update(install));
}
else
{
return BadRequest(_CheckMSG);
}
}
///
/// 删除安装单
///
/// 编号数组
///
[HttpPost("delete")]
public async Task Delete(string[] ids)
{
await InstallService.Delete(ids);
return Ok();
}
///
/// 获取安装单列表
///
/// 查询条件
///
[HttpPost("list")]
public async Task List(PageYearSearch pageSearch)
{
return Ok(await InstallService.List(pageSearch));
}
///
/// 获取安装单详情
///
/// 编号
///
[HttpGet("get")]
public async Task Get([FromQuery] string id)
{
return Ok(await InstallService.Get(id));
}
///
/// 获取安装单步骤
///
/// 编号
///
[HttpGet("getsteps")]
public async Task GetSteps([FromQuery] string installId)
{
return Ok(await InstallService.GetStepsDO(installId));
}
}
}