CSharp-Single-EFCore/Bunny.WebApi/Controllers/BlogController.cs

29 lines
665 B
C#

using Bunny.Dao.Models.System;
using Bunny.Dao.Result;
using Bunny.Service.IService;
using Microsoft.AspNetCore.Mvc;
namespace Bunny.WebApi.Controllers;
[Route("/api/[controller]")]
public class BlogController : ControllerBase
{
private readonly IBlogService _blogService;
public BlogController(IBlogService blogService)
{
_blogService = blogService;
}
/// <summary>
/// 添加Blog
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpGet("AddBlog")]
public Result<string> AddBlog(Blog dto)
{
_blogService.AddBlog(dto);
return Result<string>.Success();
}
}