// GET: InviteUsersToGroup public async Task <ActionResult> Index([FromUri] string subname = "", int?groupId = null) { var filter = new UserFilterDto { SubName = subname }; var user = await BasicUserFacade.GetUserByNickNameAsync(User.Identity.Name); var users = await BasicUserFacade.GetUsersBySubnameAsync(subname); var basicUserDtos = users as IList <BasicUserDto> ?? users.ToList(); foreach (var u in basicUserDtos) { await BasicUserFacade.AssignGroupsToUserAsync(u); } var basicUserWithFriends = await BasicUserFacade.GetBasicUserWithGroups(user.Id); return(View("InviteUsersToGroupView", new InviteUsersToGroupModel { Filter = filter, Users = basicUserDtos, User = basicUserWithFriends, GroupId = groupId })); }
// GET: GroupProfile public async Task <ActionResult> Index(int groupId) { var groupProfile = await GroupProfileFacade.GetGroupProfileAsync(groupId); var authUser = await BasicUserFacade.GetUserByNickNameAsync(User.Identity.Name); var userGroups = await BasicUserFacade.GetBasicUserWithGroups(authUser.Id); var group = await GroupGenericFacade.GetAsync(groupId); if (userGroups.Groups.Where(groupUser => groupUser.Group.Id == groupId || !group.IsPrivate).IsNullOrEmpty()) { throw new HttpException(404, "Some description"); } else { return(View("GroupProfile", new GroupProfileModel { GroupProfile = groupProfile, AuthenticatedUser = authUser })); } }