public async Task <IActionResult> Edit(int id, [Bind("LessonID,TrainerID,StudioClassID,MemberID,Capacity,LessonDay,LessonTime")] Lesson lesson) { if (id != lesson.LessonID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lesson); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LessonExists(lesson.LessonID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudioClassID"] = new SelectList(_context.StudioClass, "ID", "ID", lesson.StudioClassID); ViewData["TrainerID"] = new SelectList(_context.Trainers, "TrainersID", "TrainersID", lesson.TrainerID); ViewData["MemberID"] = new SelectList(_context.Members, "MembersID", "MembersID"); return(View(lesson)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,ClassName,Type,DuringTime,BurnCalories")] StudioClass studioClass) { if (id != studioClass.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studioClass); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudioClassExists(studioClass.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(studioClass)); }
public async Task <IActionResult> Edit(int id, [Bind("TrainersID,TrainerName,Seniority,PhoneNumber,Email")] Trainers trainers) { if (id != trainers.TrainersID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trainers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrainersExists(trainers.TrainersID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(trainers)); }