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); }
public ActionResult LoadCalendar() { List <FarmInfoItem> model = InfoItemOps.GetInfoItems("calendar").OrderBy(i => i.Date).ToList(); return(PartialView("CalendarPartial", model)); }
public ActionResult LoadNews() { List <FarmInfoItem> model = InfoItemOps.GetInfoItems("both"); return(PartialView("NewsPartial", model)); }