Example #1
0
        public IActionResult UnjoinActivity(int ActivityId)
        {
            JoinActivity RemoveJoin = _context.JoinActivities.SingleOrDefault(x => x.ActivityId == ActivityId && x.UserId == (int)HttpContext.Session.GetInt32("id"));

            _context.JoinActivities.Remove(RemoveJoin);
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Example #2
0
        public IActionResult joinActivity(int ActivityId)
        {
            JoinActivity addJoin = new JoinActivity
            {
                UserId     = (int)HttpContext.Session.GetInt32("id"),
                ActivityId = ActivityId
            };

            _context.JoinActivities.Add(addJoin);
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }