コード例 #1
0
        // DELETE /tbCatalogo/token/cdCatalogo
        public HttpResponseMessage Delete(string token, short cdCatalogo)
        {
            tbLogAcessoUsuario log = new tbLogAcessoUsuario();

            try
            {
                log = Bibliotecas.LogAcaoUsuario.New(token, JsonConvert.SerializeObject("cdCatalogo : " + cdCatalogo), "Delete");

                HttpResponseMessage retorno = new HttpResponseMessage();
                if (Permissoes.Autenticado(token))
                {
                    GatewayTbCatalogo.Delete(token, cdCatalogo);
                    log.codResposta = (int)HttpStatusCode.OK;
                    Bibliotecas.LogAcaoUsuario.Save(log);
                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    log.codResposta = (int)HttpStatusCode.Unauthorized;
                    Bibliotecas.LogAcaoUsuario.Save(log);
                    return(Request.CreateResponse(HttpStatusCode.Unauthorized));
                }
            }
            catch (Exception e)
            {
                log.codResposta = (int)HttpStatusCode.InternalServerError;
                log.msgErro     = e.Message;
                Bibliotecas.LogAcaoUsuario.Save(log);
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }