2025-07-07 18:41:36 +08:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using WorkStation.Server.Context.Entity;
|
|
|
|
|
using WorkStation.Server.Services;
|
|
|
|
|
using WorkStation.Share;
|
|
|
|
|
|
|
|
|
|
namespace WorkStation.Server.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class UserController(IUserService service) : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly IUserService _service = service;
|
|
|
|
|
[HttpPost]
|
2025-07-08 17:32:28 +08:00
|
|
|
|
public async Task<ApiResponse> Add(User item) => await _service.AddAsync(item);
|
|
|
|
|
[HttpDelete]
|
|
|
|
|
public async Task<ApiResponse> Delete(int id) => await _service.DelateAsync(id);
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<ApiRespon<List<User>>> GetAll() => await _service.GetAllAsync();
|
2025-07-07 18:41:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|