Example #1
0
        public void DeleteMenu(Menu deletedMenu)
        {
            CedroContext context = new CedroContextFactory().CreateDbContext(args);

            context.Menus.Attach(deletedMenu);
            context.Entry(deletedMenu).State = EntityState.Deleted;
            context.SaveChanges();
        }
Example #2
0
        public void DeleteRestaurant(Restaurant deletedRestaurant)
        {
            CedroContext context = new CedroContextFactory().CreateDbContext(args);

            context.Restaurants.Attach(deletedRestaurant);
            context.Entry(deletedRestaurant).State = EntityState.Deleted;
            context.SaveChanges();
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }