using CloudGaming.DtoModel.FeedBack;

using Microsoft.IdentityModel.Tokens;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudGaming.Code.Other;

/// <summary>
/// 
/// </summary>
public class FeedBackBLL : CloudGamingBase
{
    public FeedBackBLL(IServiceProvider serviceProvider) : base(serviceProvider)
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="feedBackRequest"></param>
    /// <returns></returns>
    /// <exception cref="ArgumentNullException"></exception>
    public async Task SendFeedBack(FeedBackRequest feedBackRequest)
    {
        if (string.IsNullOrEmpty(feedBackRequest.Text))
        {
            throw new ArgumentNullException("请输入反馈内容");
        }
        T_User_FeedBack t_User_FeedBack = new T_User_FeedBack()
        {
            ContactUs = feedBackRequest.ContactUs,
            CreateTime = DateTime.Now,
            UpdateTime = DateTime.Now,
            Text = feedBackRequest.Text,
            UserId = _UserId
        };
        await Dao.DaoPhone.Context.T_User_FeedBack.AddAsync(t_User_FeedBack);
        await Dao.DaoPhone.Context.SaveChangesAsync();
    }
}