예제 #1
0
 public ActionResult Login(string email, string password)
 {
     User userOut = new User();
     bool result = UserAPIController.Login(email, password, out userOut);
     if (result)
     {
         Session.Add("UserName", userOut.UserName);
         Session.Add("UserID", userOut.ID);
         Session.Add("CartID", userOut.CartID);
         return Redirect("/");
     }
     else
     {
         ViewBag.Email = email;
         ViewBag.Password = "";
         ViewBag.Error = true;
         return View();
     }
 }
예제 #2
0
        public ActionResult UserAdmin(int userid, string username, string email)
        {
            HttpResult result = UserAPIController.EditUser(userid, username, email);

            if (result.Result)
            {
                ViewBag.Success = true;
            }
            else
            {
                ViewBag.Error = result.Message;
            }
            User user = new User()
            {
                ID       = userid,
                UserName = username,
                Email    = email
            };

            ViewBag.User = user;
            return(View());
        }