不同的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();
}

posted on 2015-03-15 21:27  木屐  阅读(155)  评论(0编辑  收藏  举报

导航