Files
Backend-Api/ServiceHost/Areas/Admin/Controllers/ProgramManager/SalaryPaymentSettingsController.cs

68 lines
2.1 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Commands.CreateSalarySettings;
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Commands.EditSalarySettings;
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetSalarySettingToEdit;
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Enums;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
public class SalaryPaymentSettingsController : ProgramManagerBaseController
{
private readonly IMediator _mediator;
public SalaryPaymentSettingsController(IMediator mediator)
{
_mediator = mediator;
}
[HttpGet("PersianDayOfWeekDictionary")]
public IActionResult GetPersianDayOfWeekDictionary()
{
var names = Enum.GetNames(typeof(PersianDayOfWeek));
return Ok(names);
}
[HttpGet("GetUsers")]
public async Task<ActionResult<OperationResult<GetUserListWhoHaveSettingsResponse>>> GetUserListWhoHaveSettings([FromQuery] GetUserListWhoHaveSettingsQuery command)
{
var res = await _mediator.Send(command);
return res;
}
[HttpGet("GetToEdit/{UserId}")]
public async Task<ActionResult<OperationResult<GetSalarySettingToEditResponse>>> GetSalarySettingsByUserId(long UserId)
{
var query = new GetSalarySettingToEditQuery(UserId);
var res = await _mediator.Send(query);
return res;
}
[HttpPost("edit")]
public async Task<ActionResult<OperationResult>> Edit([FromBody] EditSalarySettingsCommand command)
{
var res = await _mediator.Send(command);
return res;
}
[HttpPost("create")]
public async Task<ActionResult<OperationResult>> Create([FromBody] CreateSalarySettingsCommand command)
{
var res = await _mediator.Send(command);
return res;
}
}