using System.ComponentModel.DataAnnotations;
using Entity.Base;
using Entity.DbModel.Station;
using Entity.DbModel.System;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Service.Station;
namespace WebStarter.Controllers.System;
///
/// 电池运营模型
///
[ApiController]
[Route("api/[controller]")]
public class BatteryOpModelController
{
private readonly BatteryOpModelService _batteryOpModelService;
public BatteryOpModelController(BatteryOpModelService batteryOpModelService)
{
_batteryOpModelService = batteryOpModelService;
}
///
/// 获取电池运营模型分页列表
///
///
///
[HttpPost]
[Route("page")]
public async Task>> BatteryOpModelPageList([FromBody] PageBatteryOpReq input)
{
return Result>.Success(await _batteryOpModelService.Page(input));
}
///
/// 增加电池运营模型
///
///
///
[HttpPost]
[Route("add")]
public async Task> AddBatteryOpModel([FromBody] AddBatteryOpReq input)
{
var data = await _batteryOpModelService.AddBatteryOpModel(input);
return Result.Success(data);
}
///
/// 更新电池运营模型
///
///
///
[HttpPost]
[Route("update")]
public async Task> UpdateBatteryOpModel([FromBody] UpdateBatteryOpReq batteryOpReq)
{
var data = await _batteryOpModelService.UpdateBatteryOpModel(batteryOpReq);
if (data)
return Result.Success(data);
else
return Result.Fail(data);
}
///
/// 删除电池运营模型
///
///
///
[HttpPost]
[Route("delete")]
public async Task> DeleteBatteryOpModel([FromBody] [Required] DeleteBatteryOpReq input)
{
var data = await _batteryOpModelService.DeleteBatteryOpModel(input);
if (data)
return Result.Success(data);
else
return Result.Fail(data);
}
}