public bool Add(Player newPlayer) { using (var context = new BRDbContext()) { context.Players.Add(newPlayer); context.SaveChanges(); } return(true); }
/// <summary> Adds a map to the repository.</summary> /// <param name="map">The instance of Map to be saved.</param> /// <returns> true if map was saved in repository otherwise false</returns> public bool Add(Map map) { using (var context = new BRDbContext()) { context.Maps.Add(map); int nrOfEntriesWritten = context.SaveChanges(); if (nrOfEntriesWritten == 1) { return(true); } } return(false); }