public async Task <IActionResult> AssignCategory(List <AssignCategoryModel> list) { TempData["Active"] = ActivePage.Blog; int id = (int)TempData["blogId"]; foreach (var item in list) { if (item.Exists) { var model = new CategoryBlogDto { BlogId = id, CategoryId = item.CategoryId }; await _blogService.AddToCategoryAsync(model); } else { var model = new CategoryBlogDto { BlogId = id, CategoryId = item.CategoryId }; await _blogService.RemoveFromCategoryAsync(model); } } return(RedirectToAction("Index")); }
public async Task <IActionResult> AddToCategory(CategoryBlogDto categoryBlogDto) { await _blogService.AddToCategoryAsync(categoryBlogDto); return(Created("", categoryBlogDto)); }
public async Task <IActionResult> AddToCategory(CategoryBlogDto model) { await _blogService.AddToCategoryAsync(model); return(Created("", model)); }