public GenericCommandResult AtivarDesativarItemSistema([FromBody] AtivarDesativarItemSistemaCommand command, [FromServices] SistemaHandler handler, [FromServices] ISistemaItemRepository sistema_item_repository) { return((GenericCommandResult)handler.Handle(new AtivarDesativarItemSistemaCommand(command.IdItemSistema, command.Ativo, sistema_item_repository))); }
public ICommandResult Handle(AtivarDesativarItemSistemaCommand command) { //Fail Fast Validation command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, _msgError, command.Notifications)); } var item_sistema = _sistema_item_repository.ObterPorId(command.IdItemSistema); item_sistema.AtivarDesativar(command.Ativo); _sistema_item_repository.Atualizar(item_sistema); //Retorna o resultado return(new GenericCommandResult(true, "Item do Sistema alterado com Sucesso!", null)); }