public IHttpActionResult Delete(int id)
        {
            try
            {
                var entityInDb = _empresaBusiness.GetById(id);

                //Verifica se objeto existe
                if (entityInDb == null)
                {
                    return(NotFound());
                }

                if (_empresaBusiness.Delete(id))
                {
                    //Monta response
                    _result = Ok(Retorno <bool> .Criar(true, "Deleção Realizada Com Sucesso", true));

                    //Retorna o response
                    return(_result);
                }
                else
                {
                    return(BadRequest("Nenhum registro deletado. Verifique os dados enviados."));
                }
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
示例#2
0
        public ActionResult Delete(Guid id)
        {
            _empresaBusiness.Delete(id);

            return(Ok());
        }