Exemplo n.º 1
0
 public Users(string Username, string Paswordtext, string Firstname, string LastName, string Email, Usertype type)
 {
     this.Username    = Username;
     this.Paswordtext = stringUtil.Crypt(Paswordtext);
     this.Firstname   = Firstname;
     this.LastName    = LastName;
     this.Email       = Email;
     this.type        = type;
 }
Exemplo n.º 2
0
        public static Usertype GetOrInsert(string name)
        {
            try
            {
                Usertype usertype = DB.Usertype.Find(x => x.name == name).FirstOrDefault();
                if (usertype == null)
                {
                    Usertype newuser = new Usertype(name);
                    DB.Usertype.InsertOne(newuser);
                    return(newuser);
                }

                return(usertype);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Utilizador" + e.ToString());
            }
        }
Exemplo n.º 3
0
        public static bool Insert(string Username, string Paswordtext, string Firstname, string LastName, string Email, Usertype type)
        {
            try
            {
                Users newuser = new Users(Username, Paswordtext, Firstname, LastName, Email, type);
                DB.User.InsertOne(newuser);

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Utilizador" + e.ToString());
            }
        }