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; }
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()); } }
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()); } }