public HttpResponseMessage GetAutor(int id) { Autor autor = null; using (var repository = new AutorRepository()) { autor = repository.GetById(id); } return(Request.CreateResponse(HttpStatusCode.OK, autor)); }
public async Task <IActionResult> Get(int id) { try { var autor = await _repo.GetById(id); var results = _mapper.Map <AutorDto>(autor); return(Ok(results)); } catch (Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha ao retornar dados")); } }
public ActionResult <AutorViewModel> Get(int Id) { return(Ok(_mapper.Map <AutorViewModel>(_autorRepository.GetById(Id)))); }