Ejemplo 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);
     }
 }
Ejemplo n.º 2
0
 public List <Player> player_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Players = db.Players.ToList();
         return(Players);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo n.º 4
0
 public List <Game> Game_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var directors = db.Games.ToList();
         return(directors);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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();
     }
 }
Ejemplo n.º 7
0
 public List <Rating> rating_print()
 {
     using (Course_workContext db = new Course_workContext())
     {
         var Ratings = db.Ratings.ToList();
         return(Ratings);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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();
     }
 }
Ejemplo 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();
     }
 }
Ejemplo 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();
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }
Ejemplo 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);
     }
 }