public List<Account> GetAllAccounts() { using (var context = new HearthChartContext()) { return (from acc in context.Accounts select acc).ToList(); } }
public void AddNewAccount(Account account) { using (var context = new HearthChartContext()) { context.Accounts.Add(account); context.SaveChanges(); } }
public Deck GetDeckById(int id) { using (var context = new HearthChartContext()) { return (from deck in context.Decks where deck.Id == id select deck).Include(deck => deck.Matches).FirstOrDefault(); } }
public List<Deck> GetAllDecks(string username) { using (var context = new HearthChartContext()) { return (from deck in context.Decks where deck.Account.Username == username select deck).ToList(); } }
public bool CheckIfUsernameExist(string username) { using (var context = new HearthChartContext()) { var account = (from acc in context.Accounts where acc.Username == username select acc).FirstOrDefault(); if (account != null) { return true; } return false; } }
public void AddNewDeck(string username, Deck deck) { using (var context = new HearthChartContext()) { var account = (from acc in context.Accounts where acc.Username == username select acc).FirstOrDefault(); if (account != null) { account.Decks.Add(deck); context.SaveChanges(); } } }
public string GetHashedPassword(string username) { using (var context = new HearthChartContext()) { return (from acc in context.Accounts where acc.Username == username select acc.Password).FirstOrDefault(); } }