コード例 #1
0
        public int Insert(DatabaseHelper help)
        {
            // insert

            {
                try
                {
                    var t = new The_kho //Make sure you have a table called test in DB
                    {

                        Ma_vat_tu = this.Ma_vat_tu,                   // ID = Guid.NewGuid(),
                        Id_chat_luong = this.ID_chat_luong,
                        Don_vi = this.Don_vi,
                        Dia_diem = this.Dia_diem,

                    };

                    help.ent.The_kho.Add(t);
                    help.ent.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {

                    return 0;

                }

            }
        }
コード例 #2
0
        public int Delete(DatabaseHelper help)
        {
            var t = new The_kho //Make sure you have a table called test in DB
            {

                Ma_vat_tu = this.Ma_vat_tu,                   // ID = Guid.NewGuid(),
                Id_chat_luong = this.ID_chat_luong,
                Don_vi = this.Don_vi,
                Dia_diem = this.Dia_diem,

            };
            help.ent.The_kho.Attach(t);
            help.ent.The_kho.Remove(t);
            return help.ent.SaveChanges();
        }