namespace Tiobon.Core.Api.Controllers;

/// <summary>
/// 题目(Controller)
/// </summary>
[Route("api/[controller]")]
[ApiController, GlobalActionFilter]
[Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)]
public class Ghre_QuestionController : BaseController<IGhre_QuestionServices, Ghre_Question, Ghre_QuestionDto, InsertGhre_QuestionInput, EditGhre_QuestionInput>
{

    IGhre_QuestionAnswerServices _ghre_QuestionAnswerServices;
    public Ghre_QuestionController(IGhre_QuestionServices service, IGhre_QuestionAnswerServices ghre_QuestionAnswerServices) : base(service)
    {
        _ghre_QuestionAnswerServices = ghre_QuestionAnswerServices;
    }

    #region 基础接口
    #region 查询

    /// <summary>
    /// 根据Id查询数据
    /// </summary>
    /// <param name="Id"></param>
    /// <returns></returns>
    [HttpPost("QueryFrom/{Id}")]
    public async Task<ServiceResult<FromGhre_QuestionInput>> QueryFrom(long Id)
    {
        return await _service.QueryFrom(Id);
    }
    #endregion

    #region 新增
    /// <summary>
    /// 新增数据
    /// </summary>
    /// <param name="insertModel"></param>
    /// <returns></returns>
    [HttpPost("InsertFrom")]
    public async Task<ServiceResult> InsertFrom([FromBody] FromGhre_QuestionPageData insertModel)
    {
        return await _service.InsertFrom(insertModel);
    }
    #endregion

    #region 更新
    /// <summary>
    /// 更新数据
    /// </summary>
    /// <param name="Id">主键ID</param>
    /// <param name="editModel"></param>
    /// <returns></returns>

    [HttpPost("UpdareFrom/{Id}")]
    public async Task<ServiceResult> UpdareFrom(long Id, [FromBody] FromGhre_QuestionPageData editModel)
    {
        return await _service.UpdareFrom(Id, editModel);
    }
    #endregion

    #endregion

}