Exemplo n.º 1
0
        public static void SignIn(UserModel user)
        {
            var cookie = new HttpCookie("token")
            {
                Name = "remember_token",
                Value = user.Remember_token,
                Expires = DateTime.Now.AddYears(2)
            };

            HttpContext.Current.Response.Cookies.Set(cookie);
        }
Exemplo n.º 2
0
        public UserModel UpdateUser(UserModel updatedUser)
        {
            DataProvider.ExecuteNonQuery("sp_USUpdateUserEntity",
                new SqlParameter("@user_id", updatedUser.User_ID),
                new SqlParameter("@name", updatedUser.Name),
                new SqlParameter("@email", updatedUser.Email),
                new SqlParameter("@password", updatedUser.Password),
                new SqlParameter("@rememberToken", Encrypter.Encrypt(updatedUser.Remember_token)),
                new SqlParameter("@image_path", updatedUser.Image_path));

            return updatedUser;
        }
Exemplo n.º 3
0
        public UserModel CreateUser(UserModel newUser)
        {
            int id = DataProvider.ExecuteScalar<int>("sp_USInsertUserEntity",
                new SqlParameter("@name", newUser.Name),
                new SqlParameter("@email", newUser.Email),
                new SqlParameter("@password", Encrypter.Encrypt(newUser.Password)),
                new SqlParameter("@rememberToken", Encrypter.Encrypt(newUser.Remember_token)));

            newUser.User_ID = id;

            return newUser;
        }