public async ValueTask <IActionResult> UpdateCategory([FromBody] CategoryRequestModel categoryData) { if (!ModelState.IsValid) { return(ValidationProblem()); } var category = categoryData.ToCategory(); await categoriesAdminManager.UpdateCategoryAsync(category); categoriesCache.Reset(); contentCache.Reset(); return(Ok()); }
public async Task <IActionResult> UpdateCategory([FromBody] CategoryRequestModel categoryData) { if (!ModelState.IsValid) { return(ValidationProblem()); } var sectionType = categoriesCache.AllSectionTypes.ContainsKey(categoryData.SectionTypeName) ? categoriesCache.AllSectionTypes[categoryData.SectionTypeName] : null; var category = categoryData.ToCategory(); category.SectionTypeId = sectionType?.Id; await categoriesAdminManager.UpdateCategoryAsync(category); categoriesCache.Reset(); contentCache.Reset(); return(Ok()); }