Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
 public void Delete(ContatoDeleteCommand command)
 {
     _service.Delete(_mapper.Map <Contato>(command));
 }