Exemple #1
0
 internal List <MENUITEM> GetActives()
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         return(menuItemRepo.Select(mc => mc.STATE_ID == 1).ToList());
     }
 }
Exemple #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());
     }
 }
Exemple #3
0
 internal void Add(MENUITEM menuitem)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Insert(menuitem);
         menuItemRepo.Save();
     }
 }
Exemple #4
0
 internal void Update(CONTACT CONTACT)
 {
     using (entity = new klassycafeEntities())
     {
         ContactRepo = new GenericRepo <CONTACT>(entity);
         ContactRepo.Update(CONTACT);
         ContactRepo.Save();
     }
 }
Exemple #5
0
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Delete(id);
         menuItemRepo.Save();
     }
 }
 internal void Edit(CHEF chef)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Update(chef);
         chefRepo.Save();
     }
 }
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Delete(id);
         chefRepo.Save();
     }
 }
Exemple #8
0
 internal void Remove(int id)
 {
     using (entity = new klassycafeEntities())
     {
         reservationRepo = new GenericRepo <RESERVATION>(entity);
         reservationRepo.Delete(id);
         reservationRepo.Save();
     }
 }
 internal void Add(CHEF chef)
 {
     using (entity = new klassycafeEntities())
     {
         chefRepo = new GenericRepo <CHEF>(entity);
         chefRepo.Insert(chef);
         chefRepo.Save();
     }
 }
Exemple #10
0
 internal void Edit(RESERVATION reservation)
 {
     using (entity = new klassycafeEntities())
     {
         reservationRepo = new GenericRepo <RESERVATION>(entity);
         reservationRepo.Update(reservation);
         reservationRepo.Save();
     }
 }
Exemple #11
0
 internal void Edit(MENUITEM menuitem)
 {
     using (entity = new klassycafeEntities())
     {
         menuItemRepo = new GenericRepo <MENUITEM>(entity);
         menuItemRepo.Update(menuitem);
         menuItemRepo.Save();
     }
 }
Exemple #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();
     }
 }
        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);
        }
        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
                });
            }
        }
Exemple #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
                });
            }
        }
Exemple #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
                });
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #21
0
 public GenericRepo(klassycafeEntities context)
 {
     _context = context;
     _dbSet   = _context.Set <T>();;
 }