public IList<User_details> GetAllUsers() { IList<User_details> list = null; using (UserDataContext context = new UserDataContext(UserDataContext.DBConnectionString)) { IQueryable<User_details> query = from c in context.Users select c; list = query.ToList(); } return list; }
// Constructor public MainPage() { InitializeComponent(); using (UserDataContext context = new UserDataContext(UserDataContext.DBConnectionString)) { if (!context.DatabaseExists()) context.CreateDatabase(); } // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); }
public void AddUser(String name, String email) { using (UserDataContext context = new UserDataContext(UserDataContext.DBConnectionString)) { User_details du = new User_details(); du.user_name = name; du.user_email = email; context.Users.InsertOnSubmit(du); context.SubmitChanges(); } }