40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using Back.Services;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Shared.DTOs;
|
|
|
|
namespace Back.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class BaseController : ControllerBase
|
|
{
|
|
private readonly ServBase _sBase;
|
|
public BaseController(ServBase sBase)
|
|
{
|
|
_sBase = sBase;
|
|
}
|
|
[HttpGet("Pricing")]
|
|
public async Task<ActionResult<List<BasePriceDto>>> Pricing()
|
|
=> Ok(await _sBase.GetBasePrice());
|
|
[HttpGet("DateTimeServer")]
|
|
public async Task<ActionResult<DateTime>> DateTimeServer()
|
|
=> Ok(DateTime.Now);
|
|
[HttpGet("LastBlog")]
|
|
public async Task<ActionResult<PagingDto<BlogDto>>> LastBlog(int PageIndex,int PageSize)
|
|
=> Ok(await _sBase.GetBlog(PageIndex,PageSize));
|
|
[HttpGet("GetBlogByID/{ID}")]
|
|
public async Task<ActionResult<BlogDtoFull?>> GetBlogByID(int ID)
|
|
{
|
|
var result = await _sBase.GetBlogByID(ID);
|
|
if (result == null)
|
|
return NotFound();
|
|
return Ok(result);
|
|
}
|
|
[HttpGet("LastQuestion")]
|
|
public async Task<ActionResult<PagingDto<QuestionDto>>> LastQuestion(int PageIndex, int PageSize)
|
|
=> Ok(await _sBase.GetQuestion(PageIndex, PageSize));
|
|
|
|
}
|
|
}
|