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());
        }
        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));
 }