public void DeleteGame_Exhibition(int ID) { Game_Exhibition GameExhibition = (from ge in _context.Game_Exhibition where ge.ID_Game_Exhibition == ID select ge).SingleOrDefault(); try { _context.Game_Exhibition.Remove(GameExhibition); _context.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Warning"); Logging(ex.Message, ex.StackTrace); } }
public void AddGame_Exhibition(int ID_Game, int ID_Exhibition, int Game_Rating_On_Exhibition) { var _context = new db_MinligareevMAContext(); Game_Exhibition GameExhibition = new Game_Exhibition(); GameExhibition.ID_Game = ID_Game; GameExhibition.ID_Exhibition = ID_Exhibition; GameExhibition.Game_Rating_On_Exhibition = Game_Rating_On_Exhibition; try { _context.Game_Exhibition.Add(GameExhibition); _context.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Warning"); Logging(ex.Message, ex.StackTrace); } }
public List <Game_Exhibition> GetGameExhibitionEF() { List <Game_Exhibition> GameExhibition = new List <Game_Exhibition>(); foreach (var el in _context.Game_Exhibition) { Game_Exhibition ge = new Game_Exhibition(); ge.ID_Game_Exhibition = el.ID_Game_Exhibition; ge.Games = new Games(); ge.Games.ID_Game = el.Games.ID_Game; ge.Games.Game_Name = el.Games.Game_Name; ge.Exhibitions = new Exhibitions(); ge.Exhibitions.ID_Exhibition = el.Exhibitions.ID_Exhibition; ge.Exhibitions.Exhibition_Name = el.Exhibitions.Exhibition_Name; ge.Game_Rating_On_Exhibition = el.Game_Rating_On_Exhibition; GameExhibition.Add(ge); } return(GameExhibition.ToList()); }