2024-08-20 17:32:06 +08:00
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
2024-08-20 17:20:58 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-08-20 17:32:06 +08:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System.Security.Claims;
|
2024-08-20 17:20:58 +08:00
|
|
|
|
|
|
|
|
|
namespace asg_form.Controllers
|
2024-08-17 15:38:44 +08:00
|
|
|
|
{
|
2024-08-20 17:20:58 +08:00
|
|
|
|
public class InviteReferee : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly RoleManager<Role> roleManager;
|
|
|
|
|
private readonly UserManager<User> userManager;
|
|
|
|
|
public InviteReferee(
|
|
|
|
|
RoleManager<Role> roleManager, UserManager<User> userManager)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
this.roleManager = roleManager;
|
|
|
|
|
this.userManager = userManager;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-20 17:32:06 +08:00
|
|
|
|
[Route("api/v1/Invite")]
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Authorize]
|
|
|
|
|
public async Task<ActionResult<object>> GetReferee([FromBody] long Inviteeid)
|
|
|
|
|
{
|
|
|
|
|
string Invitorid = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
|
|
|
|
var user = await userManager.FindByIdAsync(Invitorid);
|
2024-08-17 15:38:44 +08:00
|
|
|
|
|
2024-08-20 17:32:06 +08:00
|
|
|
|
using (TestDbContext sb = new TestDbContext())
|
|
|
|
|
{
|
2024-10-09 22:22:53 +08:00
|
|
|
|
|
2024-08-20 17:32:06 +08:00
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-17 15:38:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|