Ejemplo n.º 1
0
Archivo: DbC.cs Proyecto: Elia120/C-SQL
        public static void AddCredentialToUser(int UserID, int CredentialID, string Value)
        {
            var tempAddCredentialToUser = new UsersCredential
            {
                UsersID       = UserID,
                CredentialsID = CredentialID,
                Value         = Value
            };

            using (var context = new SSESEntities())
            {
                context.UsersCredentials.Add(tempAddCredentialToUser);
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public static List <UsersCredential> PrintAndGetDoorCredential(int Id)
        {
            List <UsersCredential> CerdRe = new List <UsersCredential>();

            using (var context = new SSESEntities())
            {
                var tempDoor = (from Door in context.DoorsCredentials where Door.DoorsID == Id select Door);
                foreach (var door in tempDoor)
                {
                    Console.WriteLine("Please enter/scan your " + GetCredentialName(door.CredentialsID));

                    var tempAddCredentialToUser = new UsersCredential
                    {
                        CredentialsID = door.CredentialsID,
                        Value         = Console.ReadLine()
                    };
                    CerdRe.Add(tempAddCredentialToUser);
                }
            }
            return(CerdRe);
        }