Created
April 12, 2023 21:42
-
-
Save mokarchi/a484d21b926d0141a99a2cce29c02484 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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