public IActionResult DeleteUserActivityPlan(int ActivityPlanID) { UserActivityPlan deleteMe = _context.UserActivityPlans.SingleOrDefault(uap => uap.UserID == (int)HttpContext.Session.GetInt32("logged_id") && uap.ActivityPlanID == ActivityPlanID); _context.UserActivityPlans.Remove(deleteMe); _context.SaveChanges(); return(RedirectToAction("ShowDashboard")); }
public IActionResult AddUserActivityPlan(int ActivityID) { UserActivityPlan addMe = new UserActivityPlan { UserID = (int)HttpContext.Session.GetInt32("logged_id"), ActivityPlanID = ActivityID }; _context.UserActivityPlans.Add(addMe); _context.SaveChanges(); return(RedirectToAction("ShowDashboard")); }