不同的action传值
public ActionResult Register3(string UserName,string Password)
{
YongHu yh = new YongHu();
yh.UserName = UserName;
yh.Password = Password;
yh.IsQiYong = true;
mvcDbEntities db = new mvcDbEntities();
db.YongHu.Add(yh);
int i= db.SaveChanges();
if(i<0)
{
return Content("添加成功");
}
else
{
return RedirectToAction("Index", "Home", new { msg="添加失败"});
}
}
public ActionResult Index()
{
if (!string.IsNullOrEmpty(Request["msg"]))
{
ViewData["msg"] = Request["msg"];
}
return View();
}