public static void Delete(int identifier) { using (TradeProAssistantContext context = new TradeProAssistantContext()) { try { TradeTicket tradeticket = context.TradeTickets.Find(identifier); context.Entry(tradeticket).State = EntityState.Deleted; context.SaveChanges(); } catch { } } }
public static int Save(TradeTicket tradeticket) { using (TradeProAssistantContext context = new TradeProAssistantContext()) { context.Entry(tradeticket).State = tradeticket.IsNew ? EntityState.Added : EntityState.Modified; context.SaveChanges(); return(tradeticket.Identifier); } }
public static void Delete(TradeTicket tradeticket) { Delete(tradeticket.Identifier); }