public void Execute(CategoryPutDto request) { _validator.ValidateAndThrow(request); var category = _context.Categories.Find(request.Id); if (category == null) { throw new EntityNotFoundException(request.Id, typeof(Category)); } category.Name = request.Name; _context.SaveChanges(); }
public void Put([FromBody] CategoryPutDto dto, [FromServices] IUpdateCategoryCommand command) { executor.ExecuteCommand(command, dto); }