public IActionResult Activity(IFormCollection controls) { var id = Convert.ToInt32(controls["Id"]); try { ChildCare.GetAllActivitiesById(id); return(RedirectToAction(nameof(Index))); } catch (FormatException) { _toastNotification.AddErrorToastMessage("Acitivites List not completed!"); ViewBag.ErrorMessage = "Invalid Child Id!"; var person = ChildCare.GetAllActivitiesById(id); return(View(person)); } }
public IActionResult Activity(int?id) { var person = ChildCare.GetAllActivitiesById(id.Value); return(View(person)); }