public async Task <IActionResult> Edit(int id, [Bind("Id,NameKyrg,NameRus")] DictRegion dictRegion)
        {
            if (id != dictRegion.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dictRegion);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DictRegionExists(dictRegion.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dictRegion));
        }
        public async Task <IActionResult> Create([Bind("Id,NameKyrg,NameRus")] DictRegion dictRegion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dictRegion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dictRegion));
        }
        // GET: Monument/ListOfMonuments/Create
        public IActionResult Create()
        {
            DictRegion region = _context.DictRegion.FirstOrDefault();

            // чтобы по умолчанию не передавать все районы, здесь
            // передаётся только районы к-е входят в первый регион в БД
            List <DictDistrict> dicts = _context.DictDistrict
                                        .Include(d => d.DictRegion)
                                        .Where(d => d.DictRegionId == region.Id)
                                        .ToList();

            ViewData["DictDistrictId"]              = new SelectList(dicts, "Id", "NameRus");
            ViewData["DictRegionId"]                = new SelectList(_context.DictRegion, "Id", "NameRus");
            ViewData["DictTypeOfMonumentId"]        = new SelectList(_context.DictTypeOfMonument, "Id", "NameRus");
            ViewData["DictAffiliationOfMonumentId"] = new SelectList(_context.DictAffiliationOfMonument, "Id", "NameRus");
            return(View());
        }