public async Task <IActionResult> UpdateKind(int id, KindDto kindDto) { var kind = await _repo.Find <Kind>(id); if (kind == null) { return(BadRequest("Kind not found!")); } kind.Icon = kindDto.Icon; await _repo.SaveAllChangesAsync(); return(Ok(kind)); }
public async Task <IActionResult> UpdateComponent(int id, ComponentDto componentDto) { Component component = await _repo.Find <Component>(id); if (component == null) { return(BadRequest("Component not found")); } component.Icon = componentDto.Icon; component.CategoryId = componentDto.CategoryId; await _repo.SaveAllChangesAsync(); return(Ok(component)); }
public async Task <IActionResult> UpdateCategory(int id, CategoryDto categoryDto) { Category category = await _repo.Find <Category>(id); if (category == null) { return(BadRequest("Category not found")); } category.Icon = categoryDto.Icon; await _repo.UpdateComponents(id, categoryDto); await _repo.SaveAllChangesAsync(); return(Ok(category)); }