public JsonResult LoadImages(long id) { StadiumDao dao = new StadiumDao(); var stadium = dao.GetByID(id); var images = stadium.MoreImages; if (images != null) { XElement xImages = XElement.Parse(images); List <string> listImagesReturn = new List <string>(); foreach (XElement element in xImages.Elements()) { listImagesReturn.Add(element.Value); } return(Json(new { data = listImagesReturn }, JsonRequestBehavior.AllowGet)); } else { List <string> listImagesReturn = new List <string>(); return(Json(new { data = listImagesReturn }, JsonRequestBehavior.AllowGet)); } }