tags:

views:

92

answers:

1

I am trying to get my head around the sharp architecture and follow the tutorial. I am using this code:

using Bla.Core;
using System.Collections.Generic;
using Bla.Core.DataInterfaces;
using System.Web.Mvc;
using SharpArch.Core;
using SharpArch.Web;
using Bla.Web;

namespace Bla.Web.Controllers
{
    public class UsersController
    {
        public UsersController(IUserRepository userRepository)
        {
            Check.Require(userRepository != null,"userRepository may not be null"); 
            this.userRepository = userRepository;
        } 

        public ActionResult ListStaffMembersMatching(string filter) {
            List<User> matchingUsers = userRepository.FindAllMatching(filter);
            return View("ListUsersMatchingFilter", matchingUsers);
        }

        private readonly IUserRepository userRepository;
    }
}

I get this error:

The name 'View' does not exist in the current context

I have used all the correct using statements and referenced the assemblies as far as I can see. The views live in Bla.Web in this architecture.

Can anyone see the problem?

Thanks.

Christian

+2  A: 

You should inherit UsersController from System.Web.Mvc.Controller class. View() method is defined in Controller class.

public class UsersController : Controller
{
//...
}
Yaroslav
great thanks! I overlooked this. When I add a controller in the 'normal' asp.net mvc env. this is done automatically.
csetzkorn