コード例 #1
0
        public async Task <IActionResult> Edit(int id)
        {
            if (id == 0)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var apiResource = await _apiResourceService.GetApiResourceByIdAsync(id);

            if (apiResource == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View(CommonMappers.Mapper.Map <ApiResourceModel>(apiResource)));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id)
        {
            var jsonSerializerSettings = new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };
            var apiResource = await _service.GetApiResourceByIdAsync(id);

            var jsonString = JsonConvert.SerializeObject(apiResource, Formatting.None, jsonSerializerSettings);

            ViewData["Data"] = jsonString;
            return(View());
        }
コード例 #3
0
 public Task <ApiResourceDto> GetApiResourceByIdAsync(int id)
 {
     return(apiResourceService.GetApiResourceByIdAsync(id));
 }