Пример #1
0
        public async Task <IActionResult> ApiScope(ApiScopeDto apiScope)
        {
            if (!ModelState.IsValid)
            {
                return(View(apiScope));
            }

            _apiScopeService.BuildApiScopeViewModel(apiScope);

            int apiScopeId;

            if (apiScope.Id == 0)
            {
                apiScopeId = await _apiScopeService.AddApiScopeAsync(apiScope);
            }
            else
            {
                apiScopeId = apiScope.Id;
                await _apiScopeService.UpdateApiScopeAsync(apiScope);
            }

            SuccessNotification(string.Format(_localizer["SuccessAddApiScope"], apiScope.Name), _localizer["SuccessTitle"]);

            return(RedirectToAction(nameof(ApiScope), new { Scope = apiScopeId }));
        }