public IList <User_details> GetAllUsers() { IList <User_details> list = null; using (UkooDataContext context = new UkooDataContext(UkooDataContext.DBConnectionString)) { IQueryable <User_details> query = from c in context.Users select c; list = query.ToList(); } return(list); }
public void AddUser(String name, String pass) { using (UkooDataContext context = new UkooDataContext(UkooDataContext.DBConnectionString)) { User_details du = new User_details(); du.user_name = name; du.user_pass = pass; context.Users.InsertOnSubmit(du); context.SubmitChanges(); } }
/* * // Data context for the local database * private ThisRoot thisDB; * * // Define an observable collection property that controls can bind to. * private ObservableCollection<Roots> _roots; * public ObservableCollection<Roots> Root * { * get * { * return _roots; * } * set * { * _roots = value; * } * } */ //constructor public LoginPage() { InitializeComponent(); progressbar.Visibility = System.Windows.Visibility.Collapsed; using (UkooDataContext context = new UkooDataContext(UkooDataContext.DBConnectionString)) { if (!context.DatabaseExists()) { context.CreateDatabase(); } } // Connect to the database and instantiate data context. //thisDB = new ThisRoot(ThisRoot.DBConnectionString); // Data context and observable collection are children of the main page. this.DataContext = this; }