Ejemplo n.º 1
0
        public static void Start()
        {
            DB database = new DB(DBUrl, DBUser, DBPwd, DBName);

            rest = new Rest.RestServer("http://" + BaseURI + "/", "rest", 0, false);

            rest.ConstructDataBase(Assembly.GetExecutingAssembly(), Force, Delete);
            rest.AddRouting <Authentication>("auth");
            rest.AddRouting <Search>("users/search", typeof(core_customer));
            rest.AddRouting <HomePage>("index", typeof(core_customer));
            rest.AddRouting <HomePage>("", typeof(core_customer));
            rest.AddRouting <Register>("register", typeof(core_customer));
            rest.AddRouting <Login>("login", typeof(core_customer));
            rest.AddRouting <Catalog>("catalog", typeof(sales_catalog_car));
            rest.AddRouting <MyAccount>("myaccount", typeof(core_customer));
            rest.AddRouting <Editaccount>("editaccount", typeof(core_customer));
            rest.AddRouting <Invoices>("invoices", typeof(core_customer));
            rest.AddRouting <Contact>("contact", typeof(core_customer));
            rest.AddRouting <Overons>("overons", typeof(core_customer));
            rest.AddRouting <Admin>("admin", typeof(core_customer));
            rest.AddRouting <AdminAuth>("adminauth", typeof(core_customer));
            rest.AddRouting <AdminManage>("admin/manage", typeof(core_customer));
            rest.AddRouting <Dayoverview>("admin/cars/day", typeof(core_customer));
            rest.AddRouting <Cars>("admin/cars", typeof(sales_catalog_car));
            rest.AddRouting <CarAdd>("admin/cars/add", typeof(sales_catalog_car));
            rest.AddRouting <Image>("image", typeof(sales_catalog_car));
            rest.AddRouting <Customers>("admin/customers", typeof(core_customer));
            rest.AddRouting <Contacts>("admin/contacts", typeof(core_contact));

            foreach (sales_catalog_car car in DB.GetModel("sales_catalog_car").Select("car_license_plate").Load().ToDataSet <sales_catalog_car>())
            {
                rest.AddRouting <Car>("car/" + car.car_license_plate, typeof(sales_catalog_car));
                rest.AddRouting <Rent>("rent/" + car.car_license_plate, typeof(sales_flat_order));
                rest.AddRouting <Complete>("complete/" + car.car_license_plate, typeof(sales_flat_order));
                rest.AddRouting <EditCar>("admin/car/edit/" + car.car_license_plate, typeof(sales_catalog_car));
            }

            rest.AddNoAuthUrl("admin");
            rest.AddNoAuthUrl("car");
            rest.AddNoAuthUrl("contact");
            rest.AddNoAuthUrl("overons");
            rest.AddNoAuthUrl("invoices");
            rest.AddNoAuthUrl("rent");
            rest.AddNoAuthUrl("complete");
            rest.AddNoAuthUrl("catalog");
            rest.AddNoAuthUrl("auth");
            rest.AddNoAuthUrl("corecustomer");
            rest.AddNoAuthUrl("editaccount");
            rest.AddNoAuthUrl("index");
            rest.AddNoAuthUrl("myaccount");
            rest.AddNoAuthUrl("");
            rest.AddNoAuthUrl("register");
            rest.AddNoAuthUrl("login");
            rest.ConstructService(Assembly.GetExecutingAssembly());
            rest.Start();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Rest.RestServer rs = new Rest.RestServer("http://localhost", "pokemon", 25565);
            //rs.Start();

            rs.AddRouting<Hoi>("functions");
            rs.AddRouting<CreateSession>("auth");

            Server.Main.Start();
            Console.ReadKey();
        }