12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using MTWorkHR.Application.Filters;
- using MTWorkHR.Application.Identity;
- using MTWorkHR.Application.Models;
- using MTWorkHR.Application.Services.Interfaces;
- using MTWorkHR.Identity.Services;
- namespace MTWorkHR.API.Controllers
- {
- [Route("api/[controller]")]
- [ApiController]
- [AppAuthorize]
- public class SubscriptionController : ControllerBase
- {
- private readonly ISubscriptionService _SubscriptionConfigurationService;
- public SubscriptionController(ISubscriptionService UserSubscriptionConfigurationService)
- {
- this._SubscriptionConfigurationService = UserSubscriptionConfigurationService;
- }
- [HttpGet("GetAll")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<List<SubscriptionConfigurationDto>>> GetAll([FromQuery] PagingInputDto pagingInput)
- {
- return Ok(await _SubscriptionConfigurationService.GetAll(pagingInput));
- }
- [HttpGet("Get")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<SubscriptionConfigurationDto>> Get(long SubscriptionConfigurationId)
- {
- return Ok(await _SubscriptionConfigurationService.GetById(SubscriptionConfigurationId));
- }
- [HttpPost("Create")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- [Authorize(Policy = "SuperAdminOnly")]
- public async Task<ActionResult<SubscriptionConfigurationDto>> Create([FromBody] SubscriptionConfigurationDto input)
- {
- return await _SubscriptionConfigurationService.Create(input);
- }
- [HttpPost("Update")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- [Authorize(Policy = "SuperAdminOnly")]
- public async Task<ActionResult<SubscriptionConfigurationDto>> Update([FromBody] SubscriptionConfigurationDto input)
- {
- return await _SubscriptionConfigurationService.Update(input);
- }
- [HttpDelete("Delete")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- [Authorize(Policy = "SuperAdminOnly")]
- public async Task Delete([FromQuery]long id)
- {
- await _SubscriptionConfigurationService.Delete(id);
- }
- }
- }
|