public HttpResponseMessage Guardar([FromBody] M_ListaPedido c)
        {
            try
            {
                if (ValidarAutorizacion())
                {
                    var x = ListaPedidoRepositorio.Guardar(c);

                    if (x == false)
                    {
                        return(OkResponse("Hubo un error al recuperar el registro"));
                    }
                    else
                    {
                        return(OkResponse(x));
                    }
                }
                else
                {
                    return(OkResponse("No tiene acceso"));
                }
            }
            catch (Exception)
            {
                return(ErrorResponse("Ha ocurrido un error"));

                throw;
            }
        }
 public static ListaPedido ConvertToDBTable(M_ListaPedido c)
 {
     return(new ListaPedido
     {
         IDPedido = c.IDPedido,
         IDProducto = c.IDProducto,
         cantidad = c.cantidad,
     });
 }
        public static bool Guardar(M_ListaPedido c)
        {
            try
            {
                var db = new EcomerceEntities();
                var x  = ConvertToDBTable(c);

                db.ListaPedido.Add(x);
                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }