Esempio n. 1
0
        ///create
        public void AddCustomer(Customer c)
        {
            T_Customers tc = new T_Customers {
                cust_id = c.Id, cust_name = c.Name
            };                                                                       //check convert

            using (testDBEntities ctx = new testDBEntities())
            {
                ctx.T_Customers.Add(tc);
                ctx.SaveChanges();
            }
        }
Esempio n. 2
0
        //delete
        public int DeleteCustomer(Customer c)
        {
            T_Customers tc;

            using (testDBEntities ctx = new testDBEntities())
            {
                tc = ctx.T_Customers.Where(x => x.cust_id == c.Id).FirstOrDefault();
                if (tc != null)
                {
                    ctx.T_Customers.Remove(tc);
                }

                return(ctx.SaveChanges());
            }
        }