public async Task <IActionResult> Edit(int id, [Bind("Id,NameRus,NameKyrg,DictLegalFormId,INN,LastNameDirector,FirstNameDirector,PatronicNameDirector,DictEduInstTypeId,DictFinSourceId,RegistrationDate,ReregistrationDate,DeactiveDate,CreateDate,ApplicationUserId,LegalDocuments")] ListOfEduInstituts listOfEduInstituts)
        {
            if (id != listOfEduInstituts.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string uid = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                    listOfEduInstituts.ApplicationUserId = uid;

                    _context.Update(listOfEduInstituts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListOfEduInstitutsExists(listOfEduInstituts.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictEduInstTypeId"] = new SelectList(_context.DictEduInstType, "Id", "NameRus", listOfEduInstituts.DictEduInstTypeId);
            ViewData["DictFinSourceId"]   = new SelectList(_context.DictFinSource, "Id", "NameRus", listOfEduInstituts.DictFinSourceId);
            ViewData["DictLegalFormId"]   = new SelectList(_context.DictLegalForm, "Id", "NameRus", listOfEduInstituts.DictLegalFormId);
            return(View(listOfEduInstituts));
        }
        public async Task <IActionResult> Create([Bind("Id,NameRus,NameKyrg,DictLegalFormId,INN,LastNameDirector,FirstNameDirector,PatronicNameDirector,DictEduInstTypeId,DictFinSourceId,RegistrationDate,ReregistrationDate,DeactiveDate,CreateDate,ApplicationUserId,LegalDocuments")] ListOfEduInstituts listOfEduInstituts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listOfEduInstituts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictEduInstTypeId"] = new SelectList(_context.DictEduInstType, "Id", "NameRus", listOfEduInstituts.DictEduInstTypeId);
            ViewData["DictFinSourceId"]   = new SelectList(_context.DictFinSource, "Id", "NameRus", listOfEduInstituts.DictFinSourceId);
            ViewData["DictLegalFormId"]   = new SelectList(_context.DictLegalForm, "Id", "NameRus", listOfEduInstituts.DictLegalFormId);
            return(View(listOfEduInstituts));
        }
        // GET: Theatrical/ListOfEduInstituts/Create
        public IActionResult Create()
        {
            ViewData["DictEduInstTypeId"] = new SelectList(_context.DictEduInstType, "Id", "NameRus");
            ViewData["DictFinSourceId"]   = new SelectList(_context.DictFinSource, "Id", "NameRus");
            ViewData["DictLegalFormId"]   = new SelectList(_context.DictLegalForm, "Id", "NameRus");

            string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            ListOfEduInstituts model = new ListOfEduInstituts();

            model.CreateDate        = DateTime.Now;
            model.NameKyrg          = "NULL";
            model.ApplicationUserId = uid;

            return(View(model));
        }