public void TearDown() { using (var db = new GameMarketContext()) { var selectedGenres = from c in db.Genres where c.GenreName == "VR" select c; var selectedGenres2 = from c in db.Genres where c.GenreName == "Adventure" select c; var selectedGenres3 = from c in db.Genres where c.GenreName == "Maze" select c; var selectedGenres4 = from c in db.Genres where c.GenreName == "FPS" select c; db.Genres.RemoveRange(selectedGenres); db.Genres.RemoveRange(selectedGenres2); db.Genres.RemoveRange(selectedGenres3); db.Genres.RemoveRange(selectedGenres4); db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedDevs = from c in db.Developers where c.DeveloperName == "Bioware" select c; var selectedDevs2 = from c in db.Developers where c.DeveloperName == "Bethesda Softworks" select c; var selectedDevs3 = from c in db.Developers where c.DeveloperName == "Treyarch" select c; db.Developers.RemoveRange(selectedDevs); db.Developers.RemoveRange(selectedDevs2); db.Developers.RemoveRange(selectedDevs3); db.SaveChanges(); } }
public void Delete(int gameId, int devID) { using (var db = new GameMarketContext()) { gameDevUpdate = db.GameDevelopers.Where(c => c.GameId == gameId && c.DeveloperId == devID).FirstOrDefault(); db.GameDevelopers.Remove(gameDevUpdate); db.SaveChanges(); } }
public void Delete(string devName) { using (var db = new GameMarketContext()) { developerUpdate = db.Developers.Where(c => c.DeveloperName == devName).FirstOrDefault(); db.Developers.Remove(developerUpdate); db.SaveChanges(); } }
public void Delete(string username) { using (var db = new GameMarketContext()) { userUpdate = db.Users.Where(c => c.Username == username).FirstOrDefault(); db.Users.Remove(userUpdate); db.SaveChanges(); } }
public void Delete(int gameId, int genreID) { using (var db = new GameMarketContext()) { gameGenreUpdate = db.GameGenres.Where(c => c.GameId == gameId && c.GenreId == genreID).FirstOrDefault(); db.GameGenres.Remove(gameGenreUpdate); db.SaveChanges(); } }
public void Delete(string genreName) { using (var db = new GameMarketContext()) { GenreUpdate = db.Genres.Where(g => g.GenreName == genreName).FirstOrDefault(); db.Genres.Remove(GenreUpdate); db.SaveChanges(); } }
public void selectedReset() { using (var db = new GameMarketContext()) { var selectedUsers = db.Users; foreach (var item in selectedUsers) { item.Selected = false; } db.SaveChanges(); } }
public void Update(string usernameOld, string usernameNew, string region, decimal wallet, string email, string password) { using (var db = new GameMarketContext()) { userUpdate = db.Users.Where(c => c.Username == usernameOld).FirstOrDefault(); userUpdate.Username = usernameNew; userUpdate.Wallet = wallet; userUpdate.Email = email; userUpdate.Password = password; db.SaveChanges(); } }
static void Main(string[] args) { using (var db = new GameMarketContext()) { //db.Add(new GameGenre() //{ // GameId = 1, // GenreId = 6 //}); db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedGames = from c in db.Games where c.Name == "Yakuza 0" select c; db.Games.RemoveRange(selectedGames); db.SaveChanges(); } }
public void Create(int gameID, int genreID) { GameGenre newGameGenre = new GameGenre() { GameId = gameID, GenreId = genreID }; using (var db = new GameMarketContext()) { db.GameGenres.Add(newGameGenre); db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedPurchase = from c in db.Purchases where c.GameId == 1 select c; db.Purchases.RemoveRange(selectedPurchase); db.SaveChanges(); } }
public void Create(int gameID, int devID) { GameDeveloper newGameDev = new GameDeveloper() { GameId = gameID, DeveloperId = devID }; using (var db = new GameMarketContext()) { db.GameDevelopers.Add(newGameDev); db.SaveChanges(); } }
public bool Update(string oldName, string newName) { using (var db = new GameMarketContext()) { var newgGenreQuery = db.Genres.Where(u => u.GenreName == newName).FirstOrDefault(); if (newgGenreQuery == null) { GenreUpdate = db.Genres.Where(c => c.GenreName == oldName).FirstOrDefault(); GenreUpdate.GenreName = newName; db.SaveChanges(); return(true); } return(false); } }
public bool Update(string oldName, string newName) { using (var db = new GameMarketContext()) { var newgDevQuery = db.Developers.Where(u => u.DeveloperName == newName).FirstOrDefault(); if (newgDevQuery == null) { developerUpdate = db.Developers.Where(c => c.DeveloperName == oldName).FirstOrDefault(); developerUpdate.DeveloperName = newName; db.SaveChanges(); return(true); } return(false); } }
public void Setup() { _crudMethods = new CRUD_PurchaseMethods(); // remove test entry in DB if present using (var db = new GameMarketContext()) { var selectedPurchase = from c in db.Purchases where c.GameId == 1 select c; db.Purchases.RemoveRange(selectedPurchase); db.SaveChanges(); } }
public decimal emailCheck(string email, string password) { using (var db = new GameMarketContext()) { var emailQuery = db.Users.Where(u => u.Email == email).FirstOrDefault(); if (emailQuery != null && emailQuery.Password == password) { currentUser = emailQuery; currentUser.Selected = true; db.SaveChanges(); return emailQuery.UserId; } return 0m; } }
public void Setup() { _crudMethods = new CRUD_GameMethods(); // remove test entry in DB if present using (var db = new GameMarketContext()) { var selectedGames = from c in db.Games where c.Name == "Yakuza 0" select c; db.Games.RemoveRange(selectedGames); db.SaveChanges(); } }
public void Update(decimal gameID, decimal devID, decimal newdevID) { using (var db = new GameMarketContext()) { var selectedGDRef = db.GameDevelopers.Where(g => g.DeveloperId == devID && g.GameId == gameID).FirstOrDefault(); db.GameDevelopers.Remove(selectedGDRef); GameDeveloper updatedGameDev = new GameDeveloper() { GameId = gameID, DeveloperId = newdevID }; db.GameDevelopers.Add(updatedGameDev); // write changes to database db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedUsers = from c in db.Users where c.Username == "unitTestUsername" select c; db.Users.RemoveRange(selectedUsers); foreach (var item in db.Users) { item.Selected = false; } db.SaveChanges(); } }
public void Setup() { // remove test entry in DB if present using (var db = new GameMarketContext()) { var selectedUsers = from c in db.Users where c.Username == "unitTestUsername" select c; db.Users.RemoveRange(selectedUsers); foreach (var item in db.Users) { item.Selected = false; } db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedGames = from b in db.GameGenres where b.GameId == 1 && b.GenreId == 2 select b; var selectedGames2 = from b in db.GameGenres where b.GameId == 1 && b.GenreId == 3 select b; db.GameGenres.RemoveRange(selectedGames); db.GameGenres.RemoveRange(selectedGames2); db.SaveChanges(); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedDevs = from b in db.GameDevelopers where b.GameId == 1 && b.DeveloperId == 1 select b; var selectedDevs2 = from b in db.GameDevelopers where b.GameId == 1 && b.DeveloperId == 3 select b; db.GameDevelopers.RemoveRange(selectedDevs); db.GameDevelopers.RemoveRange(selectedDevs2); db.SaveChanges(); } }
public bool Create(string name) { using (var db = new GameMarketContext()) { var newgGenreQuery = db.Genres.Where(u => u.GenreName == name).FirstOrDefault(); if (newgGenreQuery == null) { Genre newGenre = new Genre() { GenreName = name }; db.Genres.Add(newGenre); db.SaveChanges(); return(true); } return(false); } }
public void TearDown() { using (var db = new GameMarketContext()) { var selectedUsers = from c in db.Users where c.Username == "Beausy" select c; var selectedUsers2 = from c in db.Users where c.Username == "Beausy2" select c; db.Users.RemoveRange(selectedUsers); db.Users.RemoveRange(selectedUsers2); db.SaveChanges(); } }
public bool Create(string name) { Developer newDev = new Developer() { DeveloperName = name }; using (var db = new GameMarketContext()) { var newgDevQuery = db.Developers.Where(u => u.DeveloperName == name).FirstOrDefault(); if (newgDevQuery == null) { db.Developers.Add(newDev); db.SaveChanges(); return(true); } return(false); } }
public bool Create(string fullName, string username, string email, string password) { using (var db = new GameMarketContext()) { var newUsernameQuery = db.Users.Where(u => u.Username == username).FirstOrDefault(); var newEmailQuery = db.Users.Where(u => u.Email == email).FirstOrDefault(); if (newUsernameQuery == null && newEmailQuery == null) { User newUser = new User() { FullName = fullName, Username = username, Email = email, Password = password }; db.Users.Add(newUser); db.SaveChanges(); return(true); } return(false); } }
public void Setup() { _crudMethods = new CRUD_GameDeveloperMethods(); using (var db = new GameMarketContext()) { var selectedDevs = from b in db.GameDevelopers where b.GameId == 1 && b.DeveloperId == 1 select b; var selectedDevs2 = from b in db.GameDevelopers where b.GameId == 1 && b.DeveloperId == 3 select b; db.GameDevelopers.RemoveRange(selectedDevs); db.GameDevelopers.RemoveRange(selectedDevs2); db.SaveChanges(); } }
public void Setup() { _crudMethods = new CRUD_UserMethods(); // remove test entry in DB if present using (var db = new GameMarketContext()) { var selectedUsers = from c in db.Users where c.Username == "Beausy" select c; var selectedUsers2 = from c in db.Users where c.Username == "Beausy2" select c; db.Users.RemoveRange(selectedUsers); db.Users.RemoveRange(selectedUsers2); db.SaveChanges(); } }