public ContentResult GetMarkers(string latitude, string longitude) { var ga = new GetArticles(); double radius = 200.0; var markers = ga.PopulateDtoContent(latitude, longitude, radius).ArticleMarkerList; var markersJSON = JsonConvert.SerializeObject(markers); return new ContentResult {Content = markersJSON, ContentType = "application/json"}; }
public ActionResult listSearch(string search) { var ga = new GetArticles(); var articles = ga.SearchArticles(search); var model = new DtoContent(); model.ArticleList = articles; Session["DtoContent"] = model; return RedirectToAction("ListIndex"); }
// GET: List public ActionResult ListIndex() { DtoContent dtoContent; if (Session["DtoContent"] != null) { dtoContent = Session["DtoContent"] as DtoContent; } else { var ga = new GetArticles(); if (SessionData.Current.UserLat != null && SessionData.Current.UserLon != null) { dtoContent = ga.PopulateDtoContent(SessionData.Current.UserLat, SessionData.Current.UserLon, 200); } else { dtoContent = ga.PopulateDtoContent(500); } } if (dtoContent.ArticleList != null) { foreach (var article in dtoContent.ArticleList) { if (article.Date.Length < 10) article.Date = "0" + article.Date; article.DateTime = DateTime.ParseExact(article.Date, "dd/MM/yyyy", CultureInfo.InvariantCulture); } dtoContent.ArticleList = dtoContent.ArticleList.OrderByDescending(x => x.DateTime); } return View(dtoContent); }