0

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?

Ahmed Okour
  • 2,392
  • 1
  • 16
  • 31
Vikram
  • 675
  • 6
  • 25

1 Answers1

4

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.

Ruud van Falier
  • 8,765
  • 5
  • 30
  • 59