// POST api/<controller> public void PostPlayer(Player player) { try { string connectionString = Properties.Settings.Default.FreeFootieConnectionString; using (FreeFootieDataContext myData = new FreeFootieDataContext(connectionString)) { using (TransactionScope myScope = new TransactionScope()) { player newPalyer = new player(); var newID = (from c in myData.players select c.id).Max(); newPalyer.id = newID + 1; newPalyer.name = player.name; newPalyer.dob = Convert.ToDateTime(player.dob); newPalyer.number = player.number; myData.players.InsertOnSubmit(newPalyer); myData.SubmitChanges(); myScope.Complete(); } } } catch (Exception ex) { Common.ErrorCatch(ex, "PlayerController.PostPlayer"); } }
partial void Updateplayer(player instance);
partial void Deleteplayer(player instance);
partial void Insertplayer(player instance);