// POST /webpages_RoleLevels/token/ public HttpResponseMessage Post(string token, [FromBody] webpages_RoleLevels param) { // Abre nova conexão using (painel_taxservices_dbContext _db = new painel_taxservices_dbContext()) { tbLogAcessoUsuario log = new tbLogAcessoUsuario(); try { HttpResponseMessage retorno = new HttpResponseMessage(); log = Bibliotecas.LogAcaoUsuario.New(token, JsonConvert.SerializeObject(param), "Post", _db); if (Permissoes.Autenticado(token, _db)) { Int32 dados = GatewayWebpagesRoleLevels.Add(token, param, _db); log.codResposta = (int)HttpStatusCode.OK; Bibliotecas.LogAcaoUsuario.Save(log, _db); return(Request.CreateResponse <Int32>(HttpStatusCode.OK, dados)); } else { log.codResposta = (int)HttpStatusCode.Unauthorized; Bibliotecas.LogAcaoUsuario.Save(log, _db); 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); } } }