Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }