93 lines
3.3 KiB
C#
93 lines
3.3 KiB
C#
using GozareshgirProgramManager.Application._Common.Models;
|
|
using GozareshgirProgramManager.Application.Modules.Checkouts.Commands.CreateCheckout;
|
|
using GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetCheckoutList;
|
|
using GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
|
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ServiceHost.BaseControllers;
|
|
|
|
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
|
|
|
|
public class CheckoutController : ProgramManagerBaseController
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public CheckoutController(IMediator mediator)
|
|
{
|
|
_mediator = mediator;
|
|
}
|
|
|
|
[HttpGet("GetUsersToGroupCreating")]
|
|
public async Task<ActionResult<OperationResult<GetUserToGroupCreatingResponse>>> GetUserListWhoHaveSettings([FromQuery] GetUserToGroupCreatingQuery command)
|
|
{
|
|
|
|
var res = await _mediator.Send(command);
|
|
|
|
return res;
|
|
}
|
|
|
|
//[HttpGet("TypeOfCheckoutHandlerDictionary")]
|
|
//public IActionResult GetTypeOfCheckoutHandlerDictionary()
|
|
//{
|
|
// var names = Enum.GetNames(typeof(TypeOfCheckoutHandler));
|
|
// List<string> result = new List<string>();
|
|
|
|
// foreach (var name in names)
|
|
// {
|
|
// if (name == "CreateInGroup")
|
|
// {
|
|
// result.Add("CreateInGroup ایجاد گروهی sample('1404', '8', UserIdList : [1,2,3] ");
|
|
// result.Add("------------------------------------------------------------------------------------------------------------------------------------");
|
|
// }
|
|
|
|
// if (name == "CreateInGroup")
|
|
// {
|
|
// result.Add("GroupEditing ویرایش گروهی sample(checkoutIdList : ['3fa85f64-5717-4562-b3fc-2c963f66afa6', '3fa85f64-5717-4562-b3fc-2c963f66afa6'])");
|
|
// result.Add("------------------------------------------------------------------------------------------------------------------------------------");
|
|
// }
|
|
|
|
// if (name == "CreateInGroup")
|
|
// result.Add("SingleEdit ویرایش تکی sample(checkoutId : '3fa85f64-5717-4562-b3fc-2c963f66afa6')" );
|
|
// }
|
|
// return Ok(result);
|
|
//}
|
|
|
|
[HttpPost("Create")]
|
|
public async Task<OperationResult> Create([FromBody] List<long>? UserIdlist, string Year, string Month)
|
|
{
|
|
var createCommand = new CreateOrEditCheckoutCommand(
|
|
TypeOfCheckoutHandler.CreateInGroup,
|
|
Year,
|
|
Month,UserIdlist, new List<Guid>());
|
|
|
|
|
|
var res = await _mediator.Send(createCommand);
|
|
|
|
return res;
|
|
}
|
|
|
|
[HttpPost("Edit")]
|
|
public async Task<OperationResult> EditSingleOrGroup([FromBody] List<Guid> CheckoutIdList)
|
|
{
|
|
var createCommand = new CreateOrEditCheckoutCommand(
|
|
TypeOfCheckoutHandler.GroupEditing,
|
|
null,
|
|
null, null, CheckoutIdList);
|
|
|
|
|
|
var res = await _mediator.Send(createCommand);
|
|
|
|
return res;
|
|
}
|
|
|
|
|
|
[HttpGet("GetCheckoutList")]
|
|
public async Task<ActionResult<OperationResult<PaginationResult<GetCheckoutListResponse>>>> GetCheckoutList([FromQuery] GetCheckoutListQuery command)
|
|
{
|
|
|
|
var res = await _mediator.Send(command);
|
|
|
|
return res;
|
|
}
|
|
} |