0
votes

I'm just starting with Sitecore MVC & Glass Mapper.

I created a Heder.cshtml view & HeaderViewModel.cs.

Here's the code of the HeaderViewModel.cs file:

public class HeaderViewModel : IRenderingModel
{
    ISitecoreContext _context = new SitecoreContext();
    public SiteItem siteItem { get; set; }

    public void Initialize(Rendering rendering)
    {
        // Get current item
        var currentItem = Sitecore.Context.Item;
        siteItem = Common.GetSiteItem();
        if (siteItem != null)
        {
            // Some code here
        }
    }
 }

I'm tring to inherit this ViewModel in Header.cshtml View as:

@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<FWM.Web.ViewModels.FWM.Composites.HeaderViewModel>

But I'm getting error that Mvc namespace is not defined in Glass.Mapper.Sc.Web

How I can resolve this error?

1

1 Answers

4
votes

Glass Mapper has moved its MVC functionality to a separate assembly.
Search for Glass.Mapper.Sc.Mvc on NuGet to find the right assembly for your MVC version.