namespace Yw.Application
{
///
/// HealthIndex
///
[Route("Health/Index")]
[ApiDescriptionSettings("Health", Name = "健康指数", Order = 10000)]
public class HealthIndex_Controller : IDynamicApiController
{
private readonly Service.HealthIndex _service = new();
///
/// 获取
///
[Route("Get@V1.0")]
[HttpGet]
public HealthIndexDto Get()
{
var model = _service.GetDefault();
return model == null ? null : new HealthIndexDto(model);
}
///
/// 设置
///
///
[Route("Set@V1.0")]
[HttpPost]
public bool Set([Required] SetHealthIndexInput input)
{
var ds = _service.GetDefault();
if (ds == null)
{
var model = input.Adapt();
var id = _service.Insert(model);
return id > 0;
}
else
{
var rhs = new Model.HealthIndex(ds);
input.Adapt(rhs);
var bol = _service.Update(rhs);
return bol;
}
}
}
}