示例#1
0
        public object Get(SqlServerFortunesRequest request)
        {
            var fortunes = new List <Fortune>();

            using (var db = dbFactory.OpenDbConnection())
            {
                fortunes = db.GetFortunes();
                fortunes.Add(new Fortune {
                    id = 0, message = "Additional fortune added at request time."
                });
                fortunes.Sort();
            }

            // construct HTML page using template and return
            return(FortuneMethods.ToHtml(fortunes));
        }
        public object Get(MongoDBFortunesRequest request)
        {
            // retrieve fortunes from database
            var fortunes = db.GetFortunes();

            // add additional fortune record
            fortunes.Add(new Fortune {
                id = 0, message = "Additional fortune added at request time."
            });

            // sort fortunes
            fortunes.Sort();

            // construct HTML page using template and return
            return(FortuneMethods.ToHtml(fortunes));
        }
        public object Get(PostgreSqlFortunesRequest request)
        {
            var fortunes = new List <Fortune>();

            // retrieve fortunes from database
            using (var db = dbFactory.OpenDbConnection())
            {
                fortunes = db.GetFortunes();
            }

            // add additional fortune record
            fortunes.Add(new Fortune {
                id = 0, message = "Additional fortune added at request time."
            });

            // sort fortunes
            fortunes.Sort();

            // construct HTML page using template and return
            return(FortuneMethods.ToHtml(fortunes));
        }