예제 #1
0
        public ActionResult Login(FormCollection collection)
        {
            try
            {
                UserWS.User User = new UserWS.User();
                User.Login = collection["Login"];
                User.Password = collection["Password"];

                Users model = new Users(Session);
                User = model.Login(User);

                if (User != null)
                {
                    Session["logado"] = true;
                    Session["UserId"] = User.UserId;
                    Session["UserName"] = User.Name;
                    Session["UserLogin"] = User.Login;
                    Session["UserPassword"] = User.Password;

                    return RedirectToAction("Index", "Produto");
                }
                else
                {
                    return RedirectToAction("Index");
                }
            }
            catch
            {
                return RedirectToAction("Index");
            }
        }
예제 #2
0
 public ActionResult Index()
 {
     model = new Users(Session);
     return View(model.Index());
 }