public async void Login() { //using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(DatabaseHelper.dbFile)) //{ // connection.CreateTable<Users>(); // var user = connection.Table<Users>().Where(u => u.UserName == User.UserName).FirstOrDefault(); // if (user != null) // { // if (user.Password == User.Password) // { // App.UserId = System.Convert.ToString(user.Id); // HasLogedIn.Invoke(this, new EventArgs()); // } // } //} try { var user = (await App.mobileServiceClient.GetTable <Users>().Where(u => u.UserName == User.UserName).ToListAsync()).FirstOrDefault(); if (user != null) { if (user.Password == User.Password) { App.UserId = user.Id; HasLogedIn.Invoke(this, new EventArgs()); } } } catch (Exception ex) { } }
public void Register() { bool result = DatabaseHelper.Insert(User); if (result) { App.UserId = System.Convert.ToString(User.Id); HasLogedIn.Invoke(this, new EventArgs()); } }
public void Login() { using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(DatabaseHelper.dbFile)) { connection.CreateTable <Users>(); var user = connection.Table <Users>().Where(u => u.UsertName == User.UsertName).FirstOrDefault(); if (user != null) { if (user.Password == User.Password) { App.UserId = System.Convert.ToString(user.Id); HasLogedIn.Invoke(this, new EventArgs()); } } } }
public async void Register() { //using (SQLiteConnection conn = new SQLiteConnection(DatabaseHelper.dbFile)) //{ // conn.CreateTable<Users>(); // bool result = DatabaseHelper.Insert(User); // if (result) // { // App.UserId = System.Convert.ToString(User.Id); // HasLogedIn.Invoke(this, new EventArgs()); // } //} try { await App.mobileServiceClient.GetTable <Users>().InsertAsync(User); App.UserId = System.Convert.ToString(User.Id); HasLogedIn.Invoke(this, new EventArgs()); } catch (Exception ex) { } }