Copied to clipboard

Flag this post as spam?

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


  • Saba Tandashvili 29 posts 181 karma points
    Nov 22, 2018 @ 10:06
    Saba Tandashvili
    0

    How can I access custom controller's results from view ?

    Hi, I am making products listing page with filters. I made custom SurfaceController, where i pass filter parameters with <form>'s GET Method from view, filter items and here is the problem, how can i return filtered items back to view and how to access them in view? Here is SurfaceController Code :

    public class OffersSurfaceController : SurfaceController
    {
        public ActionResult GetFilteredOffers(int ? offersTypeId)
        {
            IEnumerable<IPublishedContent> allOffers = Umbraco.Content(1362).Children();
            IEnumerable<IPublishedContent> filteredOffers = allOffers.Where(x => x.GetPropertyValue<int>("offersItemCategory") == offersTypeId);
            // Return filteredOffers Code Goes Here
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft