Exemple #1
0
        public IActionResult CompleteInvite(string inviteCode)
        {
            Guid code;

            if (!Guid.TryParse(inviteCode, out code))
            {
                return(RedirectToAction("MissingInvite"));
            }

            CompleteInviteModel model = new CompleteInviteModel();

            model.Invite = _invitesService.GetInviteByCode(code);

            if (model.Invite == null)
            {
                return(RedirectToAction("MissingInvite"));
            }

            if (model.Invite.CompletedOn.HasValue)
            {
                return(RedirectToAction("CompletedInvite"));
            }

            model.Email = model.Invite.EmailAddress;
            model.Code  = inviteCode.ToString();

            return(View(model));
        }
Exemple #2
0
        public async Task <Response <InviteDTO> > GetInviteByCode(string code)
        {
            var response = await _invitesService.GetInviteByCode(code);

            if (response == null)
            {
                return(new SecurityErrorResponse <InviteDTO>(new []
                {
                    new Error
                    {
                        Code = ErrorCodes.Common.NotFound,
                        Message = ErrorMessages.Common.NotFound
                    }
                }));
            }

            return(response);
        }