public static void UpdateUserWins(Users usr) { using (var dbCtx = new GrafilogikaDBEntities()) { try { if (usr.Wins == null) { usr.Wins = 0; } usr.Wins++; dbCtx.Entry(usr).State = EntityState.Modified; dbCtx.SaveChanges(); } catch (Exception) { throw; } } }
public static void UpdateUserVerification(string userName) { try { using (var dbCtx = new GrafilogikaDBEntities()) { var result = (from u in dbCtx.Users where u.Name == userName select u).First(); result.Isverified++; dbCtx.Entry(result).State = EntityState.Modified; dbCtx.SaveChanges(); } } catch (Exception) { throw; } }
public static void UpdateGameWins(Games game) { using (var dbCtx = new GrafilogikaDBEntities()) { try { if (game.Wins == null) { game.Wins = 0; } game.Wins++; dbCtx.Entry(game).State = EntityState.Modified; dbCtx.SaveChanges(); } catch (Exception) { throw; } } }
public static void UpdateUserAdmin(string userName) { try { using (var dbCtx = new GrafilogikaDBEntities()) { var result = (from u in dbCtx.Users where u.Name == userName select u).First(); if (result.Isadmin == 1) { result.Isadmin = 0; } else if (result.Isadmin == 0) { result.Isadmin = 1; } dbCtx.Entry(result).State = EntityState.Modified; dbCtx.SaveChanges(); } } catch (Exception) { throw; } }
public static void UpdateGameRating(Games game, int rating) { using (var dbCtx = new GrafilogikaDBEntities()) { try { if (game.Rating == null || game.Rating == 0) { game.Rating = rating; } else { game.Rating += rating; } dbCtx.Entry(game).State = EntityState.Modified; dbCtx.SaveChanges(); } catch (Exception) { throw; } } }