using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser; using GozareshgirProgramManager.Application.Modules.Users.Commands.EditUser; using GozareshgirProgramManager.Application.Modules.Users.Queries.GetSingleUser; using GozareshgirProgramManager.Application.Modules.Users.Queries.GetUsers; using GozareshgirProgramManager.Application.Modules.Users.Queries.GetUserSelectList; using MediatR; using Microsoft.AspNetCore.Mvc; using ServiceHost.BaseControllers; namespace ServiceHost.Areas.Admin.Controllers.ProgramManager; public class UserController : ProgramManagerBaseController { private readonly IMediator _mediator; public UserController(IMediator mediator) { _mediator = mediator; } [HttpGet] public async Task>> Get([FromQuery] GetUsersQuery query) { var res = await _mediator.Send(query); return res; } [HttpGet("{accountId}")] public async Task>> GetUserByAccountId(string accountId) { var query = new GetSingleUserQuery(accountId); var res = await _mediator.Send(query); return res; } [HttpGet("GetUserSelectList")] public async Task>> GetUserSelectList() { var query = new GetUserSelectListQuery(); var res = await _mediator.Send(query); return res; } [HttpPost("create")] public async Task> Create([FromBody] CreateUserCommand command) { var res = await _mediator.Send(command); return res; } [HttpPost("edit")] public async Task> Edit([FromBody] EditUserCommand command) { var res = await _mediator.Send(command); return res; } }