public void DeleteGame_Area(int ID) { Game_Area GameArea = (from ga in _context.Game_Area where ga.ID_Game_Area == ID select ga).SingleOrDefault(); try { _context.Game_Area.Remove(GameArea); _context.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Warning"); Logging(ex.Message, ex.StackTrace); } }
public void AddGame_Area(int ID_Game, int ID_Area, int Area_Game_Cost) { var _context = new db_MinligareevMAContext(); Game_Area GameArea = new Game_Area(); GameArea.ID_Game = ID_Game; GameArea.ID_Area = ID_Area; GameArea.Area_Game_Cost = Area_Game_Cost; try { _context.Game_Area.Add(GameArea); _context.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Warning"); Logging(ex.Message, ex.StackTrace); } }
public List <Game_Area> GetGameAreaEF() { List <Game_Area> GameArea = new List <Game_Area>(); foreach (var el in _context.Game_Area) { Game_Area ga = new Game_Area(); ga.ID_Game_Area = el.ID_Game_Area; ga.Games = new Games(); ga.Games.ID_Game = el.Games.ID_Game; ga.Games.Game_Name = el.Games.Game_Name; ga.Area = new Area(); ga.Area.ID_Area = el.Area.ID_Area; ga.Area.Area_Name = el.Area.Area_Name; ga.Area_Game_Cost = el.Area_Game_Cost; GameArea.Add(ga); } return(GameArea.ToList()); }