예제 #1
0
        //when a user logins (presumably for the first time) with a
        //pdid unrecognized by the database add a new member object
        //to the database.
        public static void InsertNewGuestMember(string pdid, string name)
        {
            var    context   = new Entities();
            member guestUser = new member {
                student_pdid = pdid, full_name = name
            };

            context.members.Add(guestUser);
            context.SaveChanges();
        }
예제 #2
0
        public static List <point_type> GetLeaderPointTypePermissions(member userMember)
        {
            List <point_type> canEdit = new List <point_type>();

            if (userMember != null)
            {
                var context = new Entities();
            }

            return(canEdit);
        }
예제 #3
0
 /// <summary>
 /// Note this will only update userMember, NOT it's associated
 /// table's columns. TODO: explicitly add sub-object to context to be updated
 /// </summary>
 /// <param name="userMember"></param>
 public static void SaveUserModel(member userMember)
 {
     if (userMember == null)
     {
         return;
     }
     using (var context = new Entities())
     {
         var recordToUpdate = from m in context.members
                              where m.member_id == userMember.member_id
                              select m;
         if (recordToUpdate.Count() > 0)
         {
             member old = recordToUpdate.FirstOrDefault();
             context.Entry(old).CurrentValues.SetValues(userMember);
         }
         else
         {
             InsertNewGuestMember(userMember.student_pdid, userMember.full_name);
             return;
         }
         context.SaveChanges();
     }
 }