public IActionResult Details(int id) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); if (_groupsService.IsMember(id, userId)) { var user = _usersService.GetUser(userId); ViewBag.Name = user.FirstName + " " + user.LastName; ViewBag.UserId = userId; var model = _mapper.Map <DetailsGroupModel>(_groupsService.GetGroupWithGroupedTopics(userId, id)); _groupsService.UpdateLastVisitedGroup(userId, id); return(View(model)); } var group = _mapper.Map <JoinGroupModel>(_groupsService.GetGroup(id)); if (group != null) { return(View("Join", group)); } return(NotFound()); }