コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ProgramId,ProgramAdi,BolumId")] AspNetCoreMvcIdentity.Models.Program program)
        {
            if (id != program.ProgramId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(program);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProgramExists(program.ProgramId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BolumId"] = new SelectList(_context.Bolum, "BolumId", "BolumId", program.BolumId);
            return(View(program));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ProgramId,ProgramAdi,BolumId")] AspNetCoreMvcIdentity.Models.Program program)
        {
            if (ModelState.IsValid)
            {
                _context.Add(program);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BolumId"] = new SelectList(_context.Bolum, "BolumId", "BolumId", program.BolumId);
            return(View(program));
        }