Пример #1
0
        public async Task <ActionResult> ConfirmAsync(string token)
        {
            var id = token.To <Guid>();

            if (!Registrations.ConfirmRegistration(id))
            {
                return(this.View(this.GetRazorView <AreaRegistration>("SignUp/InvalidToken.cshtml")));
            }

            var registration = Registrations.Get(id);
            var email        = new WelcomeEmail(registration);
            await email.SendAsync();

            return(this.View(this.GetRazorView <AreaRegistration>("SignUp/Welcome.cshtml")));
        }
Пример #2
0
        public bool DeleteRegistration(int registrationId, out string response)
        {
            Registration r = Registrations.Get(registrationId);

            if (r == null)
            {
                response = $"Cannot remove Registration: No Registration with id {registrationId} was found.";
                return(false);
            }
            Event e = Events.Get(r.EventId);

            if (e == null)
            {
                response = $"Cannot remove Registration: No Event with id {r.EventId} was found.";
                return(false);
            }
            else
            {
                EnsureRegistrationsLoadedForEvent(e);
                try
                {
                    if (!e.RemoveRegistration(r.Id, out string removeRegistrationFromEventResponse))
                    {
                        response = removeRegistrationFromEventResponse;
                        return(false);
                    }
                    else
                    {
                        Complete();
                        response = "Registration successfully removed.";
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    response = ex.Message;
                    return(false);
                }
            }
        }