コード例 #1
0
        public async Task <IActionResult> UpdateAudience([FromBody] UpdateAudienceBindingModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var audience = await _audienceService.UpdateAudience(model.ClientId, model.Resources);

                    if (audience != null)
                    {
                        return(Ok(new
                        {
                            model.ClientId,
                            model.Resources
                        }));
                    }
                }
                return(BadRequest(ModelState));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                if (_env.IsDevelopment())
                {
                    return(BadRequest(ex.Message));
                }
                else
                {
                    return(BadRequest("An error occured."));
                }
            }
        }