public ActionResult Create(Library.User user, string UserAccount) { UserWeb userWeb = new UserWeb(); if (!ModelState.IsValid) { return(View("Create")); } bool isSuccess = userWeb.AddUser(user); if (isSuccess) { ViewBag.Msg = "帳號已註冊過"; return(View()); } else { byte UserClass = 0; if (Session["Id"] != null) { byte.TryParse(Session["UserClass"].ToString(), out UserClass); } if (UserClass == 2) { return(RedirectToAction("Index", "User")); } else { return(RedirectToAction("Login", "User")); } } }
public ActionResult Create(Library.User user) { if (!ModelState.IsValid) { return(View("Create")); } UserWeb userWeb = new UserWeb(); userWeb.AddUser(user); return(RedirectToAction("Index")); }