Пример #1
0
        public async Task <ActionResult> RegisterActivationCode(Invitation model)
        {
            if (ModelState.IsValid)
            {
                var invitation = _invitationRepository.GetInvitationByAuthenticationCode(model.ActivationCode,
                                                                                         model.Email);

                if (invitation.IsOk)
                {
                    IsAuthenticationCodeValid = invitation.IsOk;
                    InvitationId = invitation.Id;
                    //invitation.State = (int)InvitationStates.Valid;
                    //invitation.StateDate = DateTime.Now;
                    //context.SaveChanges();

                    if (model.IsExternalUserLogin)
                    {
                        return(await ExternalLoginConfirmation(new ExternalLoginConfirmationViewModel()
                        {
                            Email = model.Email
                        }, null));
                    }

                    return(View("Register", new RegisterViewModel()
                    {
                        Email = model.Email
                    }));
                }
                //else{ }
            }

            // If we got this far, something failed, redisplay form
            return(View("ExternalLoginFailure"));
        }
Пример #2
0
 public async Task <IdResult> CheckAuthenticationCode(string code, string email)
 {
     using (InvitationRepository _invitationRepository = new InvitationRepository())
     {
         var invitation = _invitationRepository.GetInvitationByAuthenticationCode(code, email);
         return(invitation);
     }
 }