コード例 #1
0
        public async Task <IActionResult> GetBehaviorByPageNameAsync([FromRoute] string pageName, CancellationToken cancellationToken = default)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(pageName))
                {
                    return(BadRequest());
                }

                var result = await _behaviorAppService.GetBehaviorsByPageNameAsync(pageName, cancellationToken);

                if (!result.Any())
                {
                    return(NotFound());
                }

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }