Hi all !
I'm new to Episerver.
Version 11.13.0.0
I created a ContentData TestContent class which looks like this :
public class TestContent : ContentData, IContent
{
//IContent implementation
public string Name { get; set; }
public ContentReference ContentLink { get; set; }
public ContentReference ParentLink { get; set; }
public Guid ContentGuid { get; set; }
public int ContentTypeID { get; set; }
public bool IsDeleted { get; set; }
//Test Entity implementation
public virtual string TestName { get; set; }
public virtual int TestNumber { get; set; }
public virtual string Text { get; set; }
}
Then I saved a sample through Controller as following:
public ActionResult Index()
{
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var testContent = contentRepository.GetDefault<TestContent.TestContent>
(ContentReference.RootPage);
testContent.Name = "Test2";
testContent.TestName = "Testing name";
testContent.TestNumber = 25;
testContent.Text = "Testing text2";
contentRepository.Save(testContent, Security.AccessLevel.Administer);
return View();
}
Then I checked in database that it did saved as i wanted and it is a success.
My question: I want to be able to get a list of all the things I saved earlier of this content type which is TestContent from a controller.
Thanks for all help