public async Task <IActionResult> Edit(long id, [Bind("Id,Idsubmenu,Title,Date,Number")] Productmenuinfo productmenuinfo)
        {
            if (id != productmenuinfo.Id)
            {
                return(Redirect("/Admin/productmenuinfoes/Index"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productmenuinfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!productmenuinfoExists((long)productmenuinfo.Id))
                    {
                        return(Redirect("/Admin/productmenuinfoes/Index"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Redirect("/Admin/productmenuinfoes/Index"));
            }
            var mg = _context.Menugroups.Where(b => b.Istype == true).ToList();

            var ss = _context.Menus.AsEnumerable().Where(m => mg.Any(meg => (long)meg.Id == (long)m.Id)).ToList();

            ViewData["idsubmenu"] = new SelectList(ss, "Id", "Name", productmenuinfo.Idsubmenu);
            return(View(productmenuinfo));
        }
        public async Task <IActionResult> Create([Bind("Id,Idsubmenu,Title,Date,Number")] Productmenuinfo productmenuinfo)
        {
            if (ModelState.IsValid)
            {
                productmenuinfo.Date = DateTime.Now;
                productmenuinfo.Id   = null;
                _context.Productmenuinfos.Add(productmenuinfo);
                await _context.SaveChangesAsync();

                return(Redirect("/Admin/productmenuinfoes/Index"));
            }

            ViewData["idsubmenu"] = new SelectList(_context.Menus, "Id", "Title", productmenuinfo.Idsubmenu);
            return(View(productmenuinfo));
        }