本文介绍了aspnetboilerplate和多页面Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好。对不起我的英语/我来自俄罗斯。我正在学习你的aspnetboilerplate,我有一个问题。如何在aspnetboilerplate中使用多页面Web应用程序?你能告诉我一个小例子吗?我的意思是我不能在控制器中使用appservice。
代码:
Hello. Sorry for my english/ I'm from Russia. I'm learn your aspnetboilerplate and i have a question. How can I use multi-page web application with aspnetboilerplate? Can you show me a little example? I mean that i coud not use appservice in controller.
Code:
public ActionResult Dect()
{
_memberAppService = new MemberAppService(_memberRepository);
var users = _memberAppService.GetMembersAll();
ViewBag.users = users;
return View("Dect");
}
函数GetMemberAll()中的MemberAppService类报告错误比_memberAppService为空
你能帮帮我吗? br />
提前感谢
In MemberAppService class in function GetMemberAll() application reports about error than _memberAppService is null
Can you help me?
thanks in advance
推荐答案
public class MembersUsersController : SJMControllerBase
{
private MemberAppService _memberAppService;
public MembersUsersController(MemberAppService memberAppService) {
_memberAppService = memberAppService;
}
[HttpGet]
public ActionResult MembersView()
{
var users = _memberAppService.GetMembersAll();
ViewBag.users = users.Members;
return View();
}
}
这篇关于aspnetboilerplate和多页面Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!