51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using Complex.Application.Common;
|
|
using Complex.Application.Services.TransactionServices;
|
|
using Complex.Common.Dto;
|
|
using Complex.EndPoint.Utility;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Complex.EndPoint.Controllers
|
|
{
|
|
[ApiController]
|
|
[ApiVersion("1")]
|
|
[Route("api/v{version:apiVersion}/[controller]/[action]")]
|
|
[Authorize]
|
|
public class TransactionController : Controller
|
|
{
|
|
private readonly ITransactionService _transactionService;
|
|
|
|
public TransactionController(ITransactionService transactionService)
|
|
{
|
|
_transactionService = transactionService;
|
|
}
|
|
|
|
[HttpPost]
|
|
public ResultDto<List<TransactionDto>> TransactionsList(TransactionListRequest request)
|
|
{
|
|
return _transactionService.UnitsByTransStateList(request.ComplexId, request.UnitId, request.CommonRequest);
|
|
}
|
|
|
|
[HttpPost]
|
|
public ResultDto PayCosts(PayCostsRequest request)
|
|
{
|
|
return _transactionService.PayCosts(request.UnitCostIds, request.UnitId, request.Amount, User.GetUserId(), request.Description);
|
|
}
|
|
}
|
|
|
|
public class TransactionListRequest
|
|
{
|
|
public Guid ComplexId { get; set; }
|
|
public Guid? UnitId { get; set; }
|
|
public CommonRequestDto CommonRequest { get; set; }
|
|
}
|
|
|
|
public class PayCostsRequest
|
|
{
|
|
public List<long> UnitCostIds { get; set; }
|
|
public Guid UnitId { get; set; }
|
|
public long Amount { get; set; }
|
|
public string? Description { get; set; }
|
|
}
|
|
}
|