public async void Login() { //using(SQLiteConnection connection = new SQLiteConnection(DatabaseHelper.dbFile)) //{ // connection.CreateTable<Users>(); // var user = connection.Table<Users>().Where(usr => usr.UserName == User.UserName).FirstOrDefault(); // if(user.Password == User.Password) // { // App.UserId = user.Id; // HasLoggedIn?.Invoke(this, new EventArgs()); // } //} try { var user = (await App.MobileServiceClient.GetTable <Users>().Where(u => User.UserName == u.UserName) .ToListAsync()).FirstOrDefault(); if (user.Password == User.Password) { App.UserId = user.Id; HasLoggedIn?.Invoke(this, new EventArgs()); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async void Register() { //using (SQLiteConnection connection = new SQLiteConnection(DatabaseHelper.dbFile)) //{ // connection.CreateTable<User>(); // var result = DatabaseHelper.Insert(User); // if(result) // { // App.UserId = User.Id.ToString(); // HasLoggedIn?.Invoke(this, new EventArgs()); // } //} try { await App.MobileServiceClient.GetTable <Users>().InsertAsync(User); App.UserId = User.Id.ToString(); HasLoggedIn?.Invoke(this, new EventArgs()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Register() { var result = DatabaseHelper.Insert <User>(User); if (result) { App.UserId = User.Id.ToString(); HasLoggedIn?.Invoke(this, new EventArgs()); } }
public void Register() { using (SQLiteConnection connection = new SQLiteConnection(DataBaseHelper.dbFile)) { connection.CreateTable <User>(); var result = DataBaseHelper.Insert(User); if (result) { App.UserId = User.Id.ToString(); HasLoggedIn?.Invoke(this, new EventArgs()); } } }
public void Login() { using (SQLiteConnection connection = new SQLiteConnection(DataBaseHelper.dbFile)) { connection.CreateTable <User>(); var user = connection.Table <User>().Where(x => x.UserName == User.UserName).FirstOrDefault(); if (user.Password == User.Password) { App.UserId = user.Id.ToString(); HasLoggedIn?.Invoke(this, new EventArgs()); } } }