public IActionResult Get(int id) { try { PBOnDemand pbOnDemand = _pbOnDemandRepository.GetById(id); if (pbOnDemand == null) { return(NotFound()); } return(Ok(Mapper.Map <PBOnDemandViewModel>(pbOnDemand))); } catch (Exception exception) { //Do something with the exception return(StatusCode((int)HttpStatusCode.InternalServerError)); } }