예제 #1
0
        private void UpdateCorps()
        {
            this.CorpList.Clear();
            QueryResultRows <Corporation> corps = Db.SQL <Corporation>("SELECT c FROM Corporation c");

            foreach (Corporation corp in corps)
            {
                CorpDetails corpDetails = (CorpDetails)Self.GET("/Mohamad/partial/corp/" + corp.GetObjectID());
                this.CorpList.Add(corpDetails);
            }
        }
예제 #2
0
        static void Main()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            Handle.GET("/Mohamad/start", () =>
            {
                var json = new CorpJson
                {
                    Data = null
                };

                if (Session.Current == null)
                {
                    Session.Current = new Session(SessionOptions.PatchVersioning);
                }
                json.Session = Session.Current;
                return(json);
            });

            Handle.GET("/Mohamad/partial/corp/{?}", (string id) =>
            {
                var json  = new CorpDetails();
                json.Data = DbHelper.FromID(DbHelper.Base64DecodeObjectID(id));
                return(json);
            });

            Handle.GET("/Mohamad/franchise/{?}", (string id) =>
            {
                return(Db.Scope(() =>
                {
                    var json = new FranchiseDetails();
                    json.Data = DbHelper.FromID(DbHelper.Base64DecodeObjectID(id));
                    if (Session.Current == null)
                    {
                        Session.Current = new Session(SessionOptions.PatchVersioning);
                    }
                    json.Session = Session.Current;
                    return json;
                }));
            });
        }