public async Task <IActionResult> Edit(int id, [Bind("UserId,StudyId")] UserStudy userStudy) { if (id != userStudy.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userStudy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserStudyExists(userStudy.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudyId"] = new SelectList(_context.Study, "Id", "Information", userStudy.StudyId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Mail", userStudy.UserId); return(View(userStudy)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Text,IsCorrect")] Option option) { if (id != option.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(option); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OptionExists(option.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(option)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,Password,Mail")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CorrectAnswer,Questions,NumOfOptions")] Question question) { if (id != question.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(question); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuestionExists(question.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(question)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Subject,Information")] Study study) { if (id != study.Id) { return(NotFound()); } //var s = await _context.Study.Include(x => x.Question).ThenInclude(x => x.Options).FirstOrDefaultAsync(m => m.Id == id); if (ModelState.IsValid) { try { _context.Update(study); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudyExists(study.Id)) { return(NotFound()); } else { throw; } } return(View(study)); } return(View(study)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,Mobile,Mail,Subject,Message")] Contact contact) { if (id != contact.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contact); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContactExists(contact.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(contact)); }