public async Task <IActionResult> Edit(int id, [Bind("Id,Batch,Year")] Batches batches) { if (id != batches.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(batches); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BatchesExists(batches.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(batches)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,CoursesID,BatchesID,PhoneNumber")] Registration registration) { if (id != registration.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(registration); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegistrationExists(registration.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BatchesID"] = new SelectList(_context.BatchTable, "Id", "Name", registration.BatchesID); ViewData["CoursesID"] = new SelectList(_context.CourseTable, "Id", "Name", registration.CoursesID); return(View(registration)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,UserName,Password")] 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(Student dit) { if (ModelState.IsValid) { _db.Update(dit); await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(dit)); }