public async Task <ActionResult> GetAsync(int id) { if (!ModelState.IsValid) { return(BadRequest()); } try { var result = await service.GetByIdAsync(id); if (result != null) { return(Ok(result)); } else { return(NotFound(new Response() { Status = false, Description = "No record found" })); } } catch (Exception ex) { logger.LogError(ex.Message); return(StatusCode(500, new Response() { Status = false, Description = "System error" })); } }