public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.menu_napoj where a.id_menu == id_menu &&
                           a.id_napoja == id_napoja select a;

                if (!temp.Any()) // INSERT
                {
                    this.FillEntity();
                    risContext.menu_napoj.Add(entityMenuNapoj);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    entityMenuNapoj = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
        public BMenu_napoj(menu_napoj mn)
        {
            id_napoja  = mn.id_napoja;
            id_menu    = mn.id_menu;
            cena       = mn.cena;
            mnozstvo   = mn.mnozstvo;
            id_podniku = mn.id_podniku;

            napoj = new BNapoj(mn.napoj);
            menu  = new BMenu(mn.menu);

            entityMenuNapoj = mn;
        }
        private void Reset()
        {
            id_napoja  = 0;
            id_menu    = 0;
            cena       = 0;
            mnozstvo   = 0;
            id_podniku = 0;

            napoj = new BNapoj(new napoj());
            menu  = new BMenu();

            entityMenuNapoj = new menu_napoj();
        }
        public bool Get(risTabulky risContext, int idMenu, int idNapoj)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.menu_napoj where a.id_menu == idMenu &&
                           a.id_napoja == idNapoj select a;
                entityMenuNapoj = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }