Ejemplo n.º 1
0
        public ActionResult Login(string login, string password)
        {
            User user = new User { Login = login, Password = password };
            Client cl;
            try
            {
                cl = HotelContext.SignIn(user);
                //return JavaScript("$.cookie('sid','edfgjergerf34534534ldnfg')");
                /*var cookieUser = new
                {
                    id = cl.ClientID,
                    birth_date = cl.BirthDate,
                    phone = cl.Phone,
                    personal_data = cl.PersonalData,
                    login = login,
                    password = password
                };*/
                string client_id = cl.ClientID.ToString();
                string personal_data = cl.PersonalData;

                return Json(new {id = client_id, name = personal_data}, JsonRequestBehavior.AllowGet);
                //string result = String.Format("alert('Hello ' {0});", cl.PersonalData);
                //return JavaScript("alert('ok')");
            }
            catch (Exception ex)
            {
                return Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="login">Initial value of the Login property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 public static User CreateUser(global::System.Int32 userID, global::System.String login, global::System.String password)
 {
     User user = new User();
     user.UserID = userID;
     user.Login = login;
     user.Password = password;
     return user;
 }