开发者

sharp architecture question

开发者 https://www.devze.com 2022-12-24 17:00 出处:网络
I am trying to get my head around the sharp architecture and follow the tutorial. I am using this code:

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


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

public class UsersController : Controller
{
//...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号