public IActionResult DeleteActivity(int id) { var ActivityToDelete = dbContext.Activities.FirstOrDefault(a => a.ActivityId == id); dbContext.Remove(ActivityToDelete); dbContext.SaveChanges(); return(RedirectToAction("ShowHome", "UserAndActivity")); }
public IActionResult DeleteUserAndActivity(int Id) { var RecordToDelete = dbContext.UsersAndActivities.FirstOrDefault(i => i.ActivityId == Id); dbContext.Remove(RecordToDelete); dbContext.SaveChanges(); return(RedirectToAction("ShowHome")); }