コード例 #1
0
        public async Task <IActionResult> Edit(int id)
        {
            ViewData["Active"] = "category";
            var updatedCategory = await _categoryApiService.GetByIdAsync(id);

            if (updatedCategory != null)
            {
                CategoryUpdateModel categoryUpdateModel = new CategoryUpdateModel
                {
                    Id   = updatedCategory.Id,
                    Name = updatedCategory.Name
                };
                return(View(categoryUpdateModel));
            }
            return(NotFound());
        }
コード例 #2
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var category = await _categoryApiService.GetByIdAsync(CategoryId);

            var htmlContent = $"{category.Name}";

            output.Content.SetContent(htmlContent);
        }
コード例 #3
0
        public async Task <IActionResult> Update(int id)
        {
            var categoryList = await _categoryApiService.GetByIdAsync(id);

            return(View(new CategoryUpdateModel {
                Id = categoryList.Id,
                Name = categoryList.Name
            }));
        }
コード例 #4
0
        public async Task <IActionResult> Update(int id)
        {
            TempData["active"] = "category";
            var category = await _categoryService.GetByIdAsync(id);

            return(View(new CategoryUpdateModel {
                Id = category.Id,
                Name = category.Name
            }));
        }
コード例 #5
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            if (CategoryId.HasValue)
            {
                var category = await _categoryApiService.GetByIdAsync(CategoryId.Value);

                string html = $"<div class='border border-info p-3 mb-2'>{category.Name} blogs are listed." +
                              $"<a class='float-right' href='Home'>Remove Filter</a></div>";
                output.Content.SetHtmlContent(html);
            }
        }
コード例 #6
0
        public async Task <IActionResult> Update(int id)
        {
            var result = await _categoryApiService.GetByIdAsync(id);

            CategoryUpdateModel model = new CategoryUpdateModel
            {
                Id   = result.Id,
                Name = result.Name
            };

            return(View(model));
        }
コード例 #7
0
 public IViewComponentResult Invoke(int categoryId)
 {
     return(View(_categoryApiService.GetByIdAsync(categoryId).Result));
 }
コード例 #8
0
 public IViewComponentResult Invoke(int categoryId)
 {//Asenkronik methodu kullanamıcaz oyüzden resultunu alıcaz.
     return(View(_categoryApiService.GetByIdAsync(categoryId).Result));
 }