Beispiel #1
0
        // POST api/<controller>
        public void PostPool(Pool pool)
        {
            try
            {
                string connectionString = Properties.Settings.Default.FreeFootieConnectionString;
                using (FreeFootieDataContext myData = new FreeFootieDataContext(connectionString))
                {
                    using (TransactionScope myScope = new TransactionScope())
                    {
                        pool newPool = new pool();
                        var newID = (from c in myData.pools
                                     select c.id).Max();
                        newPool.id = newID + 1;
                        newPool.name = pool.name;

                        myData.pools.InsertOnSubmit(newPool);
                        myData.SubmitChanges();
                        myScope.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                Common.ErrorCatch(ex, "PoolController.PostPool");

            }
        }
 partial void Updatepool(pool instance);
 partial void Deletepool(pool instance);
 partial void Insertpool(pool instance);