public IActionResult OnPost(int activityId) { var activity = _activityData.Delete(activityId); _activityData.Commit(); if (activity == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"The action '{activity.Name}' was successfully deleted."; return(RedirectToPage("./Index")); }
public IActionResult OnPost() { if (!ModelState.IsValid) // check the ModelState (also for checking attempted inputs etc.) { return(Page()); } if (Activity.Id > 0) { _activityData.Update(Activity); } else { _activityData.Add(Activity); } _activityData.Commit(); TempData["Message"] = "Activity saved."; return(RedirectToPage("./Detail", new { activityId = Activity.Id })); }