using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DomainResults.Mvc;
using WeatherForecast.Services;
namespace WeatherForecast.Controllers;
///
///
///
[Authorize(Policy = "")]
[ApiController]
[Route("api/[controller]")]
public class BlogItemsController : ControllerBase {
private readonly IBlogItemsService _blogItemsService;
///
///
///
///
public BlogItemsController(
IBlogItemsService blogItemsService
) {
_blogItemsService = blogItemsService;
}
///
///
///
///
///
///
///
///
///
///
[AllowAnonymous]
[HttpGet("{siteId}")]
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
return result.ToActionResult();
}
///
///
///
///
///
[Authorize]
[HttpDelete("{siteId}")]
public IActionResult Delete([FromRoute] Guid siteId) {
var result = _blogItemsService.Delete(siteId);
return result.ToActionResult();
}
}