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 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); } } }