При попытке вызова действия GetUser контроллера Account которое возвращает частичное представление, пишет что такого действия нету в этом контроллере, хотя оно есть.
@{
ViewBag.Title = "Index";
}
@using ChudoPechkaLib.Models;
@model ChudoPechkaLib.Models.Group
@section ScriptAndStyle{
}
<div>
<div>
<hr />
<span>Автор</span>
<hr />
</div>
<div id="=AuthorSection">
@{Html.RenderAction("GetUser", "Account", new { login = Model.Author.User.Login });//Вызов действия контроллера}
</div>
</div>
<div>
<div>
<hr />
<span>Участники</span>
<hr />
</div>
<div>
</div>
</div>
Контроллер
public class AccountController : ChudoPechka.Controllers.Base.BaseController
{
// GET: Account
[HttpGet]
public ActionResult Create()
{
if (!Auth.IsAuthentication)
return View();
else
return Redirect(Url.Action("Index", "Home"));
}
[HttpPost]
public ActionResult Create(RegisterModel model)
{
if (!Auth.IsAuthentication)
if (!ModelState.IsValid)
return View(model);
else
{
Auth.RegisterUser(model);
return Redirect(Url.Action("LoginIn"));
}
else
return Redirect(Url.Action("Index", "Home"));
}
[HttpGet]
public ActionResult LoginIn()
{
if (Auth.IsAuthentication)
return Redirect(Url.Action("Index", "Home"));
return View();
}
[HttpPost]
public ActionResult LoginIn(LoginModel model)
{
if (!Auth.IsAuthentication)
{
if (ModelState.IsValid && Auth.LoginIn(model.Login, model.Password))
return Redirect(Url.Action("Index", "Home"));
ModelState.AddModelError("Login", "Неверный логин или пароль");
return View(model);
}
else
return Redirect(Url.Action("Index", "Home"));
}
[HttpGet]
public ActionResult LoginOut()
{
Auth.LoginOut();
return Redirect(Url.Action("Index", "Home"));
}
[HttpGet]
public ActionResult Recovery()
{
if (Auth.IsAuthentication)
return Redirect(Url.Action("Index", "Home"));
return View();
}
[HttpPost]
public ActionResult Recovery(RecoveryModel model)
{
if (Auth.IsAuthentication)
return Redirect(Url.Action("Index", "Home"));
try
{
if (!ModelState.IsValid)
return View();
else if (Auth.UpdatePassword(model.login, model.newPass, model.responseQuestion))
return Redirect(Url.Action("LoginIn"));
else
ModelState.AddModelError("", "Неверный ответ, попробуйте ещё.");
}
catch (NullReferenceException)
{
ModelState.AddModelError("", "Пользователь не найден, попробуйте ещё.");
}
return View();
}
[HttpPost]
public ActionResult GetUserToRecovery(string login)
{
User usr;
if (Auth.GetUser(login, out usr))
return View(usr);
else
return new ChudoPechka.Controllers.Base.PartialViewResult("Пользователь с логином не найден");
}
[HttpPost]
public ActionResult GetUser(string login)//Вот он сам контроллер
{
User usr;
if (Auth.GetUser(login, out usr))
return View(usr);
else
return new ChudoPechka.Controllers.Base.PartialViewResult("Пользователь с логином не найден");
}
}
Не использую метод RenderPartial() Так как взвывающее представление относится к контроллеру Group, а GetUser() относится к контроллеру Account.
Вот что возвращает в браузер при вызове представления выше: