예제 #1
0
 public Types.User updateUser(Types.User u)
 {
     using (var ctx = new Models.Model())
     {
         Models.User u1 = ctx.users.FirstOrDefault(x => x.userId == u.userId);
         u1.username  = u.username;
         u1.firstName = u.firstName;
         u1.lastName  = u.lastName;
         u1.password  = u.password;
         ctx.SaveChanges();
         return(u);
     }
 }
예제 #2
0
 public int addUser(Types.User u)
 {
     using (var ctx = new Models.Model())
     {
         Models.User u1 = new Models.User();
         u1.username  = u.username;
         u1.firstName = u.firstName;
         u1.lastName  = u.lastName;
         u1.password  = u.password;
         ctx.users.Add(u1);
         ctx.SaveChanges();
         return(u1.userId);
     }
 }
예제 #3
0
        public Types.User verify(string username, string password)
        {
            using (var ctx = new Models.Model())
            {
                Models.User u  = ctx.users.FirstOrDefault(x => x.username == username && x.password == password);
                Types.User  u1 = new Types.User();
                u1.userId    = u.userId;
                u1.username  = u.username;
                u1.firstName = u.firstName;
                u1.lastName  = u.lastName;
                u1.password  = u.password;

                return(u1);
            }
        }
예제 #4
0
        public Types.User getUser(int userId)
        {
            using (var ctx = new Models.Model())
            {
                Models.User u  = ctx.users.FirstOrDefault(x => x.userId == userId);
                Types.User  u1 = new Types.User();
                u1.userId    = u.userId;
                u1.username  = u.username;
                u1.firstName = u.firstName;
                u1.lastName  = u.lastName;
                u1.password  = u.password;

                return(u1);
            }
        }