using System.Threading.Tasks;
using GxPress.Auth;
using GxPress.Entity;
using GxPress.Repository.Interface;
using GxPress.Request.Feedback;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace GxPress.Api.AppControllers
{
///
/// 意见反馈
///
[Route("api/app/Feedback")]
[ApiController]
[Authorize]
public class FeedbackController : ControllerBase
{
private readonly ILogger _logger;
private readonly IFeedbackRepository _feedbackRepository;
private readonly ILoginContext _loginContext;
public FeedbackController(ILogger logger, IFeedbackRepository feedbackRepository,ILoginContext loginContext)
{
_logger = logger;
_feedbackRepository = feedbackRepository;
_loginContext = loginContext;
}
/////
///// 查询分页数据
/////
/////
/////
//[HttpPost("page")]
//[AllowAnonymous]
//public async Task> GetPageList([FromBody] FeedbackPageRequest request)
//{
// return await _feedbackRepository.GetPagedList(request);
//}
///
/// 添加
///
///
///
[HttpPut("add")]
public async Task Add([FromBody] FeedbackInRequest request)
{
request.UserId = _loginContext.AccountId;
var feedback = new Feedback
{
UserId = request.UserId, Content = request.Content, FeedbackType = request.FeedbackType
};
return await _feedbackRepository.InsertAsync(feedback) > 0;
}
}
}