Skip to content

Instantly share code, notes, and snippets.

@mokarchi
Created April 12, 2023 21:42
Show Gist options
  • Select an option

  • Save mokarchi/a484d21b926d0141a99a2cce29c02484 to your computer and use it in GitHub Desktop.

Select an option

Save mokarchi/a484d21b926d0141a99a2cce29c02484 to your computer and use it in GitHub Desktop.
[ApiController]
public class StudentController : ControllerBase
{
private readonly SchoolContext _context;
public StudentController(SchoolContext context,)
{
_context = context;
}
[HttpGet("{id}")]
public StudentDto Get(long id)
{
student student = _context.student.find(id);
return new StudentDto
{
StudentId = student.Id,
Name = student.Name,
Email = student.Email
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment