Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Web API
[Produces("application/json")]
[Route("api/ApplicationUsers")]
public class ApplicationUsersController : Controller
{
private readonly ApplicationDbContext _context;
public ApplicationUsersController(ApplicationDbContext context)
{
_context = context;
}
// GET: api/ApplicationUsers/5
[HttpGet("{id}")]
public async Task<IActionResult> GetApplicationUser([FromRoute] string id)
{
var applicationUser = await _context.Users.SingleOrDefaultAsync(m => m.Id == id);
if (applicationUser == null)
{
return NotFound();
}
return Ok(applicationUser);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment