public async Task <IActionResult> Handle(AlterarCatalogoCommand request, CancellationToken cancellationToken) { ApplicationResult <bool> result = new ApplicationResult <bool>(request); //Monta o objeto com os dados do catalogo var catalogo = await CatalogoRepository.ObterAsync(request.CatalogoId); //Adiciona o catalogo no banco de dados CatalogoRepository.Atualizar(catalogo); UnitOfWork.Commit(false); result.Result = true; result.SetHttpStatusToOk("Catalogo alterado com sucesso."); return(result); }
public async Task <IActionResult> Handle(ExcluirCatalogoItemCatalogoCommand request, CancellationToken cancellationToken) { ApplicationResult <bool> result = new ApplicationResult <bool>(request); var catalogo = await CatalogoRepository.ObterAsync(request.CatalogoId); catalogo.RemoverItem(request.ItemCatalogoId); //Adiciona o catalogo no banco de dados CatalogoRepository.Atualizar(catalogo); UnitOfWork.Commit(false); result.Result = true; result.SetHttpStatusToOk("Item excluído com sucesso."); return(result); }