private static void Main(string[] args)
        {
            Console.WriteLine("Driver Program to test core features of the program");
            DbConnection1530 dbcon = new DbConnection1530();

            dbcon.SearchMapListings();//Return all
            Dictionary <string, string> queryParams = new Dictionary <string, string>();

            queryParams["Image"] = "1";//Add as many parameters as you would like
            Console.WriteLine("Testing with Dictionary");
            var list = dbcon.SearchMapListings(queryParams);

            Console.WriteLine("Done Testing");
        }
Example #2
0
        /**
         * if (x == 0 && reader[x] != DBNull.Value)
         *              {
         *                  result += reader[x];
         *              } else if (reader[x] != DBNull.Value)
         *              {
         *                  result += "~" + reader[x];
         *              }
         *             // Debug.WriteLine(reader.GetName(x) + " : " + reader[x]);
         *          }
         *
         *          result += "|";
         **/

        public ActionResult GrabListings()
        {
            DbConnection1530  db                = new DbConnection1530();
            List <MapListing> listings          = db.SearchMapListings();
            string            combinedMapString = "";

            foreach (MapListing item in listings)
            {
                combinedMapString = combinedMapString +
                                    String.Format("{0}~{1}~{2}~{3}~{4}|",
                                                  item.Image,
                                                  item.Xcord,
                                                  item.YCord,
                                                  item.Description,
                                                  item.Upvotes);
            }
            string ser = JsonConvert.SerializeObject(combinedMapString);

            Debug.WriteLine(ser);
            return(Content(ser));
        }