public IEnumerable <User> GetAllUsers() { using (var dbProvider = ProviderFactory.CreateNewDBProvider()) { return(dbProvider.SelectAll <User>().ToList()); } }
public void AddUser(User user) { using (var dbProvider = ProviderFactory.CreateNewDBProvider()) { dbProvider.Add(user); } }
public bool SaveNote(Note note) { try { IDBProvider dbProvider = ProviderFactory.CreateNewDBProvider(); dbProvider.SaveNote(note); } catch (Exception ex) { Console.WriteLine(@"There is an error:" + ex.Message); return(false); } return(true); }
public bool AddNewUser(User user) { try { IDBProvider dbProvider = ProviderFactory.CreateNewDBProvider(); dbProvider.AddUser(user); } catch (Exception ex) { Console.WriteLine(@"There is an error:" + ex.Message); return(false); } return(true); }
public User GetUserByLogin(string login) { User user; try { IDBProvider dbProvider = ProviderFactory.CreateNewDBProvider(); user = dbProvider.UserByLogin(login); } catch (Exception ex) { Console.WriteLine(@"There is an error:" + ex.Message); return(null); } return(user); }