Пример #1
0
 internal List <MENUITEM> GetActives()
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         return(menuItemRepo.Select(mc => mc.STATE_ID == 1).ToList());
     }
 }
Пример #2
0
 internal List <MENUITEM> GetForMenuSlider()
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         return(menuItemRepo.Select(mc => mc.STATE_ID == 1 && (bool)mc.MENUSLIDER_SHOW).ToList());
     }
 }
Пример #3
0
 internal void Add(MENUITEM menuitem)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Insert(menuitem);
         menuItemRepo.Save();
     }
 }
Пример #4
0
 internal void Update(CONTACT CONTACT)
 {
     using (entity = new klassycafeEntities())
     {
         ContactRepo = new GenericRepo <CONTACT>(entity);
         ContactRepo.Update(CONTACT);
         ContactRepo.Save();
     }
 }
Пример #5
0
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Delete(id);
         menuItemRepo.Save();
     }
 }
Пример #6
0
 internal void Edit(CHEF chef)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Update(chef);
         chefRepo.Save();
     }
 }
Пример #7
0
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Delete(id);
         chefRepo.Save();
     }
 }
Пример #8
0
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         reservationRepo = new GenericRepo <RESERVATION>(entity);
         reservationRepo.Delete(id);
         reservationRepo.Save();
     }
 }
Пример #9
0
 internal void Add(CHEF chef)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Insert(chef);
         chefRepo.Save();
     }
 }
Пример #10
0
 internal void Edit(RESERVATION reservation)
 {
     using (entity = new klassycafeEntities())
     {
         reservationRepo = new GenericRepo <RESERVATION>(entity);
         reservationRepo.Update(reservation);
         reservationRepo.Save();
     }
 }
Пример #11
0
 internal void Edit(MENUITEM menuitem)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Update(menuitem);
         menuItemRepo.Save();
     }
 }
Пример #12
0
 internal void Add(RESERVATION reservation)
 {
     using (entity = new klassycafeEntities())
     {
         reservation.CREATED_DATE = DateTime.Now;
         reservationRepo          = new GenericRepo <RESERVATION>(entity);
         reservationRepo.Insert(reservation);
         reservationRepo.Save();
     }
 }
Пример #13
0
        internal bool IsLoginOK(USER user)
        {
            bool isLoginOk = false;

            using (entity = new klassycafeEntities())
            {
                userRepo = new GenericRepo <USER>(entity);
                USER _user = userRepo.FindByLambda(u => u.EMAIL == user.EMAIL && u.PASSWORD == user.PASSWORD);
                if (_user != null)
                {
                    isLoginOk = true;
                }
            }
            return(isLoginOk);
        }
Пример #14
0
        internal CHEFLIST GetByIdForList(int id)
        {
            using (entity = new klassycafeEntities())
            {
                chefRepo  = new GenericRepo <CHEF>(entity);
                stateRepo = new GenericRepo <STATE>(entity);

                CHEF chef = chefRepo.FindByID(id);

                return(new CHEFLIST()
                {
                    chef = chef,
                    stateName = stateRepo.FindByID(chef.STATE_ID).NAME
                });
            }
        }
Пример #15
0
        internal RESERVATIONLIST GetByIdForList(int id)
        {
            using (entity = new klassycafeEntities())
            {
                reservationRepo = new GenericRepo <RESERVATION>(entity);
                stateRepo       = new GenericRepo <RESERVATIONSTATE>(entity);

                RESERVATION reservation = reservationRepo.FindByID(id);

                return(new RESERVATIONLIST()
                {
                    reservation = reservation,
                    reservationStateName = stateRepo.FindByID(reservation.RESERVATIONSTATE_ID).NAME
                });
            }
        }
Пример #16
0
        internal MENUITEMLIST GetByIdForList(int id)
        {
            using (entity = new klassycafeEntities())
            {
                menuItemRepo     = new GenericRepo <MENUITEM>(entity);
                stateRepo        = new GenericRepo <STATE>(entity);
                menuCategoryRepo = new GenericRepo <MENUCATEGORY>(entity);

                MENUITEM     menuitem     = menuItemRepo.FindByID(id);
                STATE        state        = stateRepo.FindByID(menuitem.STATE_ID);
                MENUCATEGORY menucategory = menuCategoryRepo.FindByID(menuitem.MENUCATEGORY_ID);

                return(new MENUITEMLIST()
                {
                    item = menuitem,
                    stateName = state.NAME,
                    categoryName = menucategory.TITLE
                });
            }
        }
Пример #17
0
        internal List <RESERVATIONLIST> GetLast(int count)
        {
            using (entity = new klassycafeEntities())
            {
                reservationRepo = new GenericRepo <RESERVATION>(entity);
                stateRepo       = new GenericRepo <RESERVATIONSTATE>(entity);

                List <RESERVATION>     rs    = reservationRepo.Select().OrderByDescending(r => r.CREATED_DATE).Take(count).ToList();
                List <RESERVATIONLIST> rList = new List <RESERVATIONLIST>();

                foreach (RESERVATION r in rs)
                {
                    rList.Add(new RESERVATIONLIST()
                    {
                        reservation          = r,
                        reservationStateName = stateRepo.FindByID(r.RESERVATIONSTATE_ID).NAME
                    });
                }

                return(rList);
            }
        }
Пример #18
0
        internal List <CHEFLIST> GetAllForList()
        {
            using (entity = new klassycafeEntities())
            {
                chefRepo  = new GenericRepo <CHEF>(entity);
                stateRepo = new GenericRepo <STATE>(entity);

                List <CHEF>     cs    = chefRepo.Select().ToList();
                List <CHEFLIST> cList = new List <CHEFLIST>();

                foreach (CHEF c in cs)
                {
                    cList.Add(new CHEFLIST()
                    {
                        chef      = c,
                        stateName = stateRepo.FindByID(c.STATE_ID).NAME
                    });
                }

                return(cList);
            }
        }
Пример #19
0
        internal List <RESERVATIONLIST> GetAllForList()
        {
            using (entity = new klassycafeEntities())
            {
                reservationRepo = new GenericRepo <RESERVATION>(entity);
                stateRepo       = new GenericRepo <RESERVATIONSTATE>(entity);

                List <RESERVATION>     rs    = reservationRepo.Select().ToList();
                List <RESERVATIONLIST> rList = new List <RESERVATIONLIST>();

                foreach (RESERVATION r in rs)
                {
                    rList.Add(new RESERVATIONLIST()
                    {
                        reservation          = r,
                        reservationStateName = stateRepo.FindByID(r.RESERVATIONSTATE_ID).NAME
                    });
                }

                return(rList);
            }
        }
Пример #20
0
        internal List <MENUITEMLIST> GetAllForList()
        {
            using (entity = new klassycafeEntities())
            {
                menuItemRepo     = new GenericRepo <MENUITEM>(entity);
                stateRepo        = new GenericRepo <STATE>(entity);
                menuCategoryRepo = new GenericRepo <MENUCATEGORY>(entity);

                List <MENUITEM>     mis    = menuItemRepo.Select().ToList();
                List <MENUITEMLIST> milist = new List <MENUITEMLIST>();

                foreach (MENUITEM mi in mis)
                {
                    milist.Add(new MENUITEMLIST()
                    {
                        item         = mi,
                        stateName    = stateRepo.FindByID(mi.STATE_ID).NAME,
                        categoryName = menuCategoryRepo.FindByID(mi.MENUCATEGORY_ID).TITLE
                    });
                }

                return(milist);
            }
        }
Пример #21
0
 public GenericRepo(klassycafeEntities context)
 {
     _context = context;
     _dbSet   = _context.Set <T>();;
 }