//Métodos Diana: // POST: api/Pedidos //public int Post() //{ // return new ClsHandlerPedidos_BL().InsertarNuevoPedido(); //} // PUT: api/Pedidos?codigoPedido=10&estadoPedido=Recibido public int Put(int codigoPedido, string estadoPedido) //Actualizar estado en general { int filas; try { filas = new ClsHandlerPedidos_BL().ActualizarEstadoPedido(codigoPedido, estadoPedido); } catch (Exception e) { throw new HttpResponseException(HttpStatusCode.ServiceUnavailable); } if (filas == 0) { throw new HttpResponseException(HttpStatusCode.BadRequest); } return(filas); }
// PUT: api/Pedidos/{idPedido} public int Put(int codigoPedido) //Recibir pedido { int filas; try { filas = new ClsHandlerPedidos_BL().RecibirPedido(codigoPedido); } catch (Exception e) { throw new HttpResponseException(HttpStatusCode.ServiceUnavailable); } if (filas == 0) { throw new HttpResponseException(HttpStatusCode.BadRequest); } return(filas); }
//Delete api/Pedidos/{id} public void Delete(int codigoPedido) { ClsHandlerPedidos_BL handler = new ClsHandlerPedidos_BL(); int filas; try { filas = handler.cancelarPedido(codigoPedido); } catch (Exception e) { throw new HttpResponseException(HttpStatusCode.ServiceUnavailable); } if (filas == 0) { throw new HttpResponseException(HttpStatusCode.NotFound); } else { throw new HttpResponseException(HttpStatusCode.NoContent); } }