Esempio n. 1
0
 public Game Game_get_by_id(int acc_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Game = db.Games.FirstOrDefault(d => d.Id == acc_id);
         return(Game);
     }
 }
Esempio n. 2
0
 public List <Player> player_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Players = db.Players.ToList();
         return(Players);
     }
 }
Esempio n. 3
0
 public List <Game> game_sort_genre(string genre, int num)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Games.OrderBy(m => m.Genre == genre).Take(num).ToList();
         return(ret);
     }
 }
Esempio n. 4
0
 public List <Game> Game_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var directors = db.Games.ToList();
         return(directors);
     }
 }
Esempio n. 5
0
 public Player Player_get_by_id(int id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Player = db.Players.Find(id);
         return(Player);
     }
 }
Esempio n. 6
0
 public void game_Rating_add(GameRating char_Rating)
 {
     using (Course_workContext db = new Course_workContext())
     {
         db.GameRatings.Add(char_Rating);
         db.SaveChanges();
     }
 }
Esempio n. 7
0
 public List <Rating> rating_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Ratings = db.Ratings.ToList();
         return(Ratings);
     }
 }
Esempio n. 8
0
 public Rating Rating_get_by_id(int Rating_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Rating = db.Ratings.FirstOrDefault(a => a.Id == Rating_id);
         return(Rating);
     }
 }
Esempio n. 9
0
 public List <Player> player_find_glob(double glob)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Players.Where(m => m.Global == glob).ToList();
         return(ret);
     }
 }
Esempio n. 10
0
 public List <Player> player_find_other(double ot)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Players.Where(m => m.Other == ot).ToList();
         return(ret);
     }
 }
Esempio n. 11
0
 public List <Player> player_find_jp(double jp)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Players.Where(m => m.Jp == jp).ToList();
         return(ret);
     }
 }
Esempio n. 12
0
 public List <Game> game_sort_year(int year, int num)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Games.OrderBy(m => m.ReleaseYear == year).Take(num).ToList();
         return(ret);
     }
 }
Esempio n. 13
0
 public List <Game> game_find_year(int year)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Games.Where(m => m.ReleaseYear == year).ToList();
         return(ret);
     }
 }
Esempio n. 14
0
 public List <Player> player_find_na(double na)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Players.Where(m => m.Na == na).ToList();
         return(ret);
     }
 }
Esempio n. 15
0
 public List <Player> player_find_eu(double eu)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Players.Where(m => m.Eu == eu).ToList();
         return(ret);
     }
 }
Esempio n. 16
0
 public List <Game> game_sort_dev(string dev, int num)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var ret = db.Games.OrderBy(m => m.Developer == dev).Take(num).ToList();
         return(ret);
     }
 }
Esempio n. 17
0
 public void Rating_edit(Rating Rating)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var a = Rating_get_by_id(Rating.Id);
         a = Rating;
         db.SaveChanges();
     }
 }
Esempio n. 18
0
 public void Game_edit(Game acc)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var d = Game_get_by_id(acc.Id);
         d = acc;
         db.SaveChanges();
     }
 }
Esempio n. 19
0
 public void Player_edit(Player char_)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var m = Player_get_by_id(char_.Id);
         m = char_;
         db.SaveChanges();
     }
 }
Esempio n. 20
0
 public int Player_add(Player char_)
 {
     using (Course_workContext db = new Course_workContext())
     {
         db.Players.Add(char_);
         db.SaveChanges();
         var m = db.Players.Max(m => m.Id);
         return(m);
     }
 }
Esempio n. 21
0
 public List <Game> game_find_genre(string genre)
 {
     using (Course_workContext db = new Course_workContext())
     {
         char symb = '%';
         genre = symb + genre + symb;
         var ret = db.Games.Where(m => EF.Functions.Like(m.Genre, genre)).ToList();
         return(ret);
     }
 }
Esempio n. 22
0
 public int Game_add(Game acc)
 {
     using (Course_workContext db = new Course_workContext())
     {
         db.Games.Add(acc);
         db.SaveChanges();
         var d = db.Games.Max(d => d.Id);
         return(d);
     }
 }
Esempio n. 23
0
 public int Rating_add(Rating Rating)
 {
     using (Course_workContext db = new Course_workContext())
     {
         db.Ratings.Add(Rating);
         db.SaveChanges();
         var a = db.Ratings.Max(a => a.Id);
         return(a);
     }
 }
Esempio n. 24
0
 public List <Game> game_find_dev(string dev)
 {
     using (Course_workContext db = new Course_workContext())
     {
         char symb = '%';
         dev = symb + dev + symb;
         var ret = db.Games.Where(m => EF.Functions.Like(m.Developer, dev)).ToList();
         return(ret);
     }
 }
Esempio n. 25
0
 public bool Player_delete(int char_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var chara = Player_get_by_id(char_id);
         if (chara == null)
         {
             return(false);
         }
         db.Players.Remove(chara);
         db.SaveChanges();
         return(true);
     }
 }
Esempio n. 26
0
 public bool game_Rating_delete(int l_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var nom = db.GameRatings.FirstOrDefault(n => n.Id == l_id);
         if (nom == null)
         {
             return(false);
         }
         db.GameRatings.Remove(nom);
         db.SaveChanges();
         return(true);
     }
 }
Esempio n. 27
0
 public bool Rating_delete(int i_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Rating = Rating_get_by_id(i_id);
         if (Rating == null)
         {
             return(false);
         }
         db.Ratings.Remove(Rating);
         db.SaveChanges();
         return(true);
     }
 }
Esempio n. 28
0
 public bool Game_delete(int acc_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var director = Game_get_by_id(acc_id);
         if (director == null)
         {
             return(false);
         }
         db.Games.Remove(director);
         db.SaveChanges();
         return(true);
     }
 }
Esempio n. 29
0
 public string game_plat_get_by_id(int l_id)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var    ret          = db.Games.FirstOrDefault(n => n.Id == l_id);
         string char_Ratings = "";
         if (ret != null)
         {
             char_Ratings += ret.Id.ToString();
             char_Ratings += ". Name: ";
             char_Ratings += ret.Name;
             char_Ratings += ". <-----> Platform: ";
             char_Ratings += ret.Platform;
             char_Ratings += '\n';
         }
         return(char_Ratings);
     }
 }
Esempio n. 30
0
 public string game_sort_rating(string genre, int num)
 {
     using (Course_workContext db = new Course_workContext())
     {
         var    ret   = db.GameRatings.Include(m => m.Game).Include(a => a.Rating).OrderByDescending(r => r.Rating.User).ToList();
         string movie = "";
         if (ret == null)
         {
             return(movie);
         }
         foreach (var r in ret)
         {
             movie += "Rating: ";
             movie += r.Rating.User.ToString();
             movie += " Name: ";
             movie += r.Game.Name;
             movie += "\n";
         }
         return(movie);
     }
 }