NestContent Get Data is always null in Surface Controller
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using Umbraco.Core.Persistence;
using Umbraco.Core.Composing;
using CarRentalProject.Model;
using NPoco;
using Umbraco.Core.Services;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Models;
using Umbraco.Core;
namespace CarRentalProject.Controllers
{
public class BookingSurfaceController : SurfaceController
{
public string test()
{
IContentService contentService = Services.ContentService;
var content = contentService.GetById(1119);
string CarRefName = content.GetValue("CarRefName").ToString();
string VehecleNo = content.GetValue("VehecleNo").ToString();
//Single media picker
var image = content.GetValue("ChooseFeatureImage").ToString();
var mediaItem = Umbraco.Media(image);
var imgUrl = mediaItem.Url;
//Multi media picker
var typedMultiMediaPicker = content.GetValue("ChooseGalleryImage").ToString();
List<string> tempMedia = typedMultiMediaPicker.Split(',').ToList();
List<GalleryImage> GalleryImages = new List<GalleryImage>();
foreach (var item in tempMedia)
{
GalleryImage galleryimg = new GalleryImage();
var mediaItems = Umbraco.Media(item);
var imgUrls = mediaItems.Url;
galleryimg.ChooseGalleryImage = imgUrls;
GalleryImages.Add(galleryimg);
}
//Add NestedContent Picker
var nestedContent = content.GetValue<IEnumerable<IPublishedElement>>("CarDetails");
//foreach (var item in tempNestedContent)
//{
// string itemValue = item;
//}
return "success";
}
}
}
NestContent Get Data is always null in Surface Controller
is working on a reply...