public void DeleteMenu(Menu deletedMenu) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Menus.Attach(deletedMenu); context.Entry(deletedMenu).State = EntityState.Deleted; context.SaveChanges(); }
public void DeleteRestaurant(Restaurant deletedRestaurant) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Restaurants.Attach(deletedRestaurant); context.Entry(deletedRestaurant).State = EntityState.Deleted; context.SaveChanges(); }
public Menu UpdateMenu(Menu updatedEntity) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Menus.Attach(updatedEntity); context.Entry(updatedEntity).State = EntityState.Modified; context.SaveChanges(); return(updatedEntity); }
public Menu CreateMenu(Menu newEntity) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Menus.Attach(newEntity); context.Entry(newEntity).State = EntityState.Added; context.SaveChanges(); return(newEntity); }
public Restaurant CreateRestaurant(Restaurant newEntity) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Restaurants.Attach(newEntity); context.Entry(newEntity).State = EntityState.Added; context.SaveChanges(); return(newEntity); }
public Restaurant UpdateRestaurant(Restaurant updatedEntity) { CedroContext context = new CedroContextFactory().CreateDbContext(args); context.Restaurants.Attach(updatedEntity); context.Entry(updatedEntity).State = EntityState.Modified; context.SaveChanges(); return(updatedEntity); }