public ActionResult <ClassesReadDTO> GetClassesById(int id) { try { var result = repository.GetById(id); if (result != null) { return(Ok(mapper.Map <ClassesReadDTO>(result))); } return(NotFound()); } catch (System.Exception msg) { return(NotFound(msg)); } }
// GET: api/Classes/5 public @class Get(int id) { return(_repository.GetById(id)); }
public async Task <IActionResult> Get(int id) { var @class = await _repository.GetById(id); return(Ok(@class)); }