Last active
November 12, 2021 10:56
-
-
Save umayeras/4e7df01647e423c03cdbbd06f5b42ff7 to your computer and use it in GitHub Desktop.
This file contains 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
[HttpGet("{id}")] | |
[ProducesResponseType(typeof(ServiceResponse), (int) HttpStatusCode.BadRequest)] | |
[ProducesResponseType(typeof(ServiceResponse), (int) HttpStatusCode.NotFound)] | |
[ProducesResponseType(typeof(ServiceResponse), (int) HttpStatusCode.OK)] | |
public async Task<IActionResult> Get(int id) | |
{ | |
if (id <= 0) | |
{ | |
return BadRequest(Messages.InvalidRequest); | |
} | |
var query = new GetSampleByIdQuery(id); | |
var sample = await Mediator.Send(query); | |
if (sample.Data == null) | |
{ | |
return NotFound(Messages.SampleNotFound); | |
} | |
return Ok(sample); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment