Esempio n. 1
0
        /* Salva uma compra */
        public int Save(Compra compra)
        {
            int rowsAffected = 0;

            try {
                context.ShowSQL(context);
                context.Compras.Add(compra);
                rowsAffected = context.SaveChanges();
                context.ShowEntityState(context);
                return(rowsAffected);
            } catch (Exception e) {
                Debug.WriteLine("Save error - " + e.Message);
                return(rowsAffected);
            }
        }
Esempio n. 2
0
        /* Salva uma promocao */
        public int Save(Promocao promocao)
        {
            int rowsAffected = 0;

            try {
                context.ShowSQL(context);
                context.Promocoes.Add(promocao);
                rowsAffected = context.SaveChanges();
                context.ShowEntityState(context);
                return(rowsAffected);
            } catch (Exception e) {
                Debug.WriteLine("Save error - " + e.Message);
                return(rowsAffected);
            }
        }