/* 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); } }
/* 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); } }