public async Task <BaseModel> checkGroupInvitationToken(string token, long UserId)
        {
            var query  = _unitOfWork.GroupEmailInvitationRepository.FindAllByQuery(c => c.Id == new Guid(token));
            var result = await query.Include("CommunityGroup").ToListAsync();

            GroupEmailInvitationDataModel model = new GroupEmailInvitationDataModel();

            if (result != null)
            {
                model = result[0];
                if (model.IsAccpeted)
                {
                    return(new BaseModel {
                        Status = true, Messsage = model.CommunityGroup.CommunityGroupURL + "-" + model.CommunityGroup.Id.ToString()
                    });
                }
                JoinCommunityGroupViewModel joinCommunityModel = new JoinCommunityGroupViewModel {
                    CommunityGroupId = model.CommunityGroup.Id,
                    UserId           = UserId
                };
                await _joinCommunityGroup.JoinCommunityGroupAsync(joinCommunityModel);

                model.IsAccpeted = true;
                model.LastUpdate = DateTime.Now;
                model.SentTo     = UserId;
                model.AcceptedOn = DateTime.Now;

                await _unitOfWork.GroupEmailInvitationRepository.Update(model);
            }
            return(new BaseModel {
                Status = true, Messsage = model.CommunityGroup.CommunityGroupURL + "-" + model.CommunityGroup.Id.ToString()
            });
        }
Пример #2
0
 public async Task <IActionResult> JoinCommunityGroup(JoinCommunityGroupViewModel model)
 {
     model.UserId = _claimAccessor.UserId;
     return(Json(await _joinCommunityGroupService.JoinCommunityGroupAsync(model)));
 }