Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rene M. Macalisang 6 posts 75 karma points
    Mar 04, 2024 @ 10:49
    Rene M. Macalisang
    0

    Convertion from IpublishedContent to Custom Model using umbraco 13

    I have an umbraco 8 code that will convert the ipublishedcontent to custom model, How to convert this approach to a umbraco 13?

    here is my version 8 code:

    public class KADUmbracoViewPageElement<T> : UmbracoViewPage<IPublishedElement> where T : class, new()
    {
        public override void Execute()
        {
        }
    
        public override void InitHelpers()
        {
            base.InitHelpers();
    
            var mapper = DependencyResolver.Current.GetService<IUmbracoMapper>();
    
            ViewModel = new T();
            mapper.Map(base.Model, ViewModel);
        }
    
        public T ViewModel { get; set; }
    }
    

    here how to call the class and convert to custom model. @inherits KAD.Umb.Foundation.Extensions.Models.KADUmbracoViewPageElement

    Can someone know how to convert this to umbraco 13?

Please Sign in or register to post replies

Write your reply to:

Draft