コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PfeID,Titre,Mention,Note")] Pfe pfe)
        {
            if (id != pfe.PfeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pfe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PfeExists(pfe.PfeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pfe));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("PfeID,Titre,Mention,Note")] Pfe pfe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pfe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pfe));
        }