public int SaveSneakers(Sneakers sneakers) { if (sneakers.Id == default) { context.Entry(sneakers).State = EntityState.Added; } else { context.Entry(sneakers).State = EntityState.Modified; } context.SaveChanges(); return(sneakers.Id); }
public void DeleteSneakers(Sneakers sneakers) { context.Sneakers.Remove(sneakers); context.SaveChanges(); }