예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] RetrainingProgram retrainingProgram)
        {
            if (id != retrainingProgram.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(retrainingProgram);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RetrainingProgramExists(retrainingProgram.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(retrainingProgram));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,MimeType,FileName,Description")] UploadedFile uploadedFile)
        {
            if (id != uploadedFile.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(uploadedFile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UploadedFileExists(uploadedFile.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(uploadedFile));
        }