示例#1
0
        // 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");
            }
        }
示例#2
0
 partial void Updateplayer(player instance);
示例#3
0
 partial void Deleteplayer(player instance);
示例#4
0
 partial void Insertplayer(player instance);