using System.ComponentModel.DataAnnotations;
using Entity.DbModel.System.App;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Station;
namespace WebStarter.Controllers;
///
/// 车队
///
[ApiController]
[Route("api/[controller]")]
public class CarTeamController
{
private readonly CarTeamService _carTeamService;
///
///
///
///
public CarTeamController(CarTeamService carTeamService)
{
_carTeamService = carTeamService;
}
///
/// 查询车队分页
///
/// 查询参数
///
[HttpPost]
[Route("GetTeamPage")]
public async Task> GetTeamPage(
[FromBody] PageCarTeamReq req)
{
return await _carTeamService.Page(req);
}
///
/// 获取所有车队
///
///
[HttpPost]
[Route("GetTeamList")]
public async Task>> GetTeamList()
{
return Result>.Success(await _carTeamService.GetTeamList());
}
///
/// 新增车队
///
///
///
[HttpPost]
[Route("add")]
public async Task> AddTeam([FromBody] [Required] AddCarTeamReq input)
{
var data = await _carTeamService.AddCarTeamReq(input);
return Result.Success(data);
}
///
/// 修改车队
///
///
///
[HttpPost]
[Route("UpdateTeam")]
public async Task> UpdateTeam([FromBody] UpdateCarTeamReq user)
{
return await _carTeamService.UpdateTeam(user);
}
///
/// 删除车队
///
///
///
[HttpPost]
[Route("delete")]
public async Task> DeleteTeam([FromBody] [Required] DeleteCarTeamReq input)
{
var data = await _carTeamService.DeleteTeam(input);
if (data)
return Result.Success(data);
else
return Result.Fail(data);
}
}