You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using Microsoft.AspNetCore.Http;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using Microsoft.EntityFrameworkCore;
|
||
|
using Teso_API.Models;
|
||
|
|
||
|
namespace Teso_API.Controllers
|
||
|
{
|
||
|
[Route("api/[controller]")]
|
||
|
[ApiController]
|
||
|
public class UsernameController : ControllerBase
|
||
|
{
|
||
|
private readonly TESOContext _context;
|
||
|
|
||
|
public UsernameController(TESOContext context)
|
||
|
{
|
||
|
_context = context;
|
||
|
}
|
||
|
|
||
|
// GET: api/Username/5
|
||
|
[HttpGet("{id}")]
|
||
|
public async Task<ActionResult> GetTesoUserDetail(string id)
|
||
|
{
|
||
|
if (!TesoUserDetailExists(id))
|
||
|
{
|
||
|
return Ok("Available");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return Conflict("Not Available");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private bool TesoUserDetailExists(string id)
|
||
|
{
|
||
|
return _context.TesoUserDetails.Any(e => e.Username == id);
|
||
|
}
|
||
|
}
|
||
|
}
|