public async Task <IActionResult> Edit(int id, [Bind("VolunteerId,DeliveryTraining,HSTraining,FirstAidRaining,OtherTrainingSkill")] VolunteerTrainingInfo volunteerTrainingInfo) { if (id != volunteerTrainingInfo.VolunteerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(volunteerTrainingInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteerTrainingInfoExists(volunteerTrainingInfo.VolunteerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VolunteerId"] = new SelectList(_context.Volunteer, "VolunteerId", "Address", volunteerTrainingInfo.VolunteerId); return(View(volunteerTrainingInfo)); }
public async Task <IActionResult> Create([Bind("VolunteerId,DeliveryTraining,HSTraining,FirstAidRaining,OtherTrainingSkill")] VolunteerTrainingInfo volunteerTrainingInfo) { if (ModelState.IsValid) { _context.Add(volunteerTrainingInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["VolunteerId"] = new SelectList(_context.Volunteer, "VolunteerId", "Address", volunteerTrainingInfo.VolunteerId); return(View(volunteerTrainingInfo)); }