Example #1
0
        public HttpResponseMessage Get(string type)
        {
            string items = "";

            switch (type)
            {
            case "calendar":
            case "news":
                List <FarmInfoItem> infoItems = InfoItemOps.GetInfoItems(type);
                items = new JavaScriptSerializer().Serialize(infoItems);
                break;

            case "map":
                List <MapItem> mapItems = MapItemOps.GetMapItems("none");
                items = new JavaScriptSerializer().Serialize(mapItems);
                break;

            case "shop":
                List <Product> products = ProductOps.GetProducts();
                items = new JavaScriptSerializer().Serialize(products);
                break;
            }

            var response = new HttpResponseMessage(HttpStatusCode.OK);

            response.Content = new StringContent(items);

            return(response);
        }
Example #2
0
 public string GetMapObjects(string filter)
 {
     try
     {
         List <MapItem> items = MapItemOps.GetMapItems(filter);
         return(JsonConvert.SerializeObject(items));
     }
     catch (Exception e)
     {
         return("error");
     }
 }
Example #3
0
        public ActionResult LoadMapList(string filter)
        {
            List <MapItem> model = MapItemOps.GetMapItems(filter);

            return(PartialView("MapListPartial", model));
        }