public IActionResult GetById(long id) { Category catObj = null; try { catObj = new Category(); catObj = catBL.GetCategoryById(id); if (catObj == null) { return(NotFound()); } } catch (Exception e) { Console.WriteLine("Exception in getting Get category by id", e); } return(new ObjectResult(catObj)); }