Answer the question
In order to leave comments, you need to log in
How to call a controller by another controller's method in ASP NET MVC?
I have a Home controller with a Login method
public class HomeController : Controller
//метод Index
public ActionResult Login(User user)
{
if (userAvail)
{
return RedirectToAction("Index", "Account", user);
}
else{
return View("Index");
}
}
}
public ViewResult Index()
{
ViewBag.info = "You have 0 messages";
return View("Account");
}
@model Login.Models.User
<div>
<h1>Welcome @Model.Name! </h1>
<p>@ViewBag.info</p>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question