Copied to clipboard

Flag this post as spam?

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


  • rehamhabbas 14 posts 103 karma points
    Mar 20, 2018 @ 19:15
    rehamhabbas
    0

    The type or namespace name 'TypedContent' does not exist in the namespace 'Umbraco' (are you missing an assembly reference?)

    > using Examine; using System; using System.Collections.Generic; using
    > System.Linq; using System.Web; using System.Web.Mvc; using
    > Umbraco.Core.Models; using Umbraco.Web.Mvc;
    > 
    > namespace ThiqahPortal.Controllers {
    >     public class OurWorksController : Controller
    >     {
    > 
    >         [HttpGet]
    >         //[OutputCache(VaryByParam = "*", Duration = 30)]
    >         public ActionResult getWorks(int StartIndex = 0, int PageSize = 10, string orderBy = "sortOrder", string language = "en")
    >         {
    >             var ids = GetWorksIDs(StartIndex, PageSize, orderBy, language);
    > 
    >             return PartialView("_SearchWorkList", Umbraco.TypedContent(ids));
    >         }
    > 
    >         private List<int> GetWorksIDs(int StartIndex = 0, int PageSize = 10, string orderBy = "sortOrder", string language = "en")
    >         {
    >             var query = string.Format("+nodeTypeAlias:ourWorksItem");
    >             return LuceneHelper.GetIDsByLuceneString(query, orderBy, "WebsiteSearcher").Skip(StartIndex).Take(PageSize).ToList();
    >         }
    > 
    >     } }
    

    I have this issue on return partial view statement The variable 'contentNode' is assigned but its value is never used

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Mar 20, 2018 @ 19:21
    Alex Skrypnyk
    100

    Hi Rehamhabbas

    Try to inherit your controller from UmbracoApiController - you will be able to use Umbraco helpers then. Read more - https://our.umbraco.org/documentation/reference/routing/webapi/

     public class OurWorksController : UmbracoApiController
         {
    
         }
    
  • rehamhabbas 14 posts 103 karma points
    Mar 20, 2018 @ 19:24
    rehamhabbas
    0

    still the same error

    The type or namespace name 'UmbracoApiController' could not be found (are you missing a using directive or an assembly reference?)

  • rehamhabbas 14 posts 103 karma points
    Mar 20, 2018 @ 19:30
    rehamhabbas
    0

    I inherit it from UmbracoController and it works now

    Thank you so much

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Mar 20, 2018 @ 19:34
    Alex Skrypnyk
    0

    You are welcome, you can mark this topic as solved and have a great evening!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies