public IActionResult Edit(Volunteer volunteer) { if (ModelState.IsValid) { repository.SaveVolunteer(volunteer); TempData["message"] = $"{volunteer.LastName}, {volunteer.FirstName} has been saved"; return(RedirectToAction("Index")); } else { // there is something wrong with the data values return(View(volunteer)); } }
public IActionResult SaveVolunteer(Volunteer volunteer) { _volunteerRepository.SaveVolunteer(volunteer); return(RedirectToAction("VolunteerList")); }