Exemplo n.º 1
0
 public ActionResult Add(User u)
 {
     if (u != null)
     {
         if (iuser.InsertUser(u) == true)
         {
             if (Session["UserID"] == null)
             {
                 Session["UserID"]   = u.ID;
                 Session["UserName"] = u.UserName;
                 Session["Admin"]    = u.IsAdmin;
             }
             iuser.Commit();
         }
         else
         {
             ViewBag.DuplicateMessage = "username already exists";
             return(View(u));
         }
     }
     return(RedirectToAction("Index"));
 }