public IActionResult Delete(string idContato) { if (!ModelState.IsValid) { return(StatusCode(400, ModelStateValidation.GetErrors(ModelState))); } try { var command = new ContatoDeleteCommand { Id = idContato }; _contatoApplicationService.Delete(command); return(Ok("O contato foi excluido com sucesso")); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public void Delete(ContatoDeleteCommand command) { _service.Delete(_mapper.Map <Contato>(command)); }