public IActionResult FindById(int ruleId)
 {
     try
     {
         var result = _ruleService.FindById(ruleId);
         return(Ok(new JsonResult(result)));
     }
     catch (Exception ex)
     {
         return(NotFound(ex));
     }
 }
Exemple #2
0
        public IActionResult GetById(int id)
        {
            AppLogger.LogResourceRequest(nameof(GetById), base.GetUsernameForRequest());

            try
            {
                var rulename = _ruleService.FindById(id);

                if (rulename == null)
                {
                    return(NotFound(AppConfig.ResourceNotFoundById + id));
                }

                return(Ok(rulename));
            }
            catch (Exception ex)
            {
                return(BadRequestExceptionHandler(ex, nameof(GetById)));
            }
        }