Пример #1
0
        public async Task <IActionResult> Edit(int id, QualificationViewModel qualification)
        {
            if (id != qualification.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(qualification.GetModel());
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QualificationExists(qualification.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            qualification.loadLists(_context);
            return(View(qualification));
        }
Пример #2
0
        public async Task <IActionResult> Create(QualificationViewModel qualification)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qualification.GetModel());
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            qualification.loadLists(_context);
            return(View(qualification));
        }