예제 #1
0
        public void updateToken(string username, string usertoken)
        {
            SqlServerDbContext context = new SqlServerDbContext();

            try
            {
                user u = context.users.First(i => i.login == username);
                u.usertoken = usertoken;
                context.SaveChanges();
            } catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
            }
        }
예제 #2
0
        public void addLog(string username)
        {
            SqlServerDbContext context = new SqlServerDbContext();

            try
            {
                user u = context.users.FirstOrDefault(i => i.login == username);

                log log = new log
                {
                    date   = DateTime.Now,
                    iduser = u.id
                };
                context.logs.Add(log);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
            }
        }
예제 #3
0
        public List <user> GetUsers()
        {
            SqlServerDbContext context = new SqlServerDbContext();

            return(context.users.ToList());
        }