Beispiel #1
0
        //
        // Delete(Person p)
        // 削除対象と同じIdを持っているPersonインスタンスを削除する
        //
        public void Delete(int _id)
        {
            using (var ctx = new fp7dataEntities1())
            {
                var deleteTarget = ctx.ex1table.Find(_id);

                try
                {
                    ctx.ex1table.Remove(deleteTarget);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                ctx.SaveChanges();
            }
        }
Beispiel #2
0
        public void Edit(int _id, int[] _val)
        {
            using (var ctx = new fp7dataEntities1())
            {
                var editRecord = ctx.ex1table.Find(_id);

                editRecord.val1 = (short)_val[0];
                editRecord.val2 = (short)_val[1];
                editRecord.val3 = (short)_val[2];
                editRecord.val4 = (short)_val[3];
                editRecord.val5 = (short)_val[4];
                editRecord.val6 = (short)_val[5];
                editRecord.val7 = (short)_val[6];
                editRecord.val8 = (short)_val[7];
                editRecord.time = DateTime.Now;
                ctx.SaveChanges();
            }
        }