예제 #1
0
        public async Task <IActionResult> Edit(int id, EduProfile eduProfile)
        {
            if (id != eduProfile.EduProfileId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.EduProfiles.Update(eduProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EduProfileExists(eduProfile.EduProfileId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EduNapravlId"] = _selectListRepository.GetSelectListEduNapravlFullNames(eduProfile.EduNapravlId);
            return(View(eduProfile));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("EduProfileId,EduProfileName,EduNapravlId")] EduProfile eduProfile)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eduProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EduNapravlId"] = _selectListRepository.GetSelectListEduNapravlFullNames(eduProfile.EduNapravlId);
            return(View(eduProfile));
        }