public ActionResult CancelTrial(CancelSubscriptionPostModel model) { _suspendOrganisationCommand.Invoke(new SuspendOrganisationRequest { OrganisationId = Core.AppContext.CurrentUser.OrganisationId, Reason = SuspendedReason.SubscriptionCancelled, Message = "Trial cancelled by user" }); return(Redirect(Url.SignOut())); }
public ActionResult SuspendOrganisation(SuspendOrganisationViewModel viewModel) { var response = _suspendOrganisationCommand.Invoke(new SuspendOrganisationRequest { Message = viewModel.Message, OrganisationId = viewModel.OrganisationId, Reason = viewModel.Reason }); ConfirmationNotification(response.Status.MapToResource(Resources.Admin.ResourceManager)); return(new JsonSuccessResult()); }
public void Execute(string ravenInstanceId) { var organisations = _session.MasterRaven.Query <OrganisationDocument, Organisations>() .Where(o => o.CurrentPeriodEndDate >= DateTime.UtcNow.Date) .Where(o => o.SubscriptionStatus == SubscriptionStatus.Cancelled && o.OrganisationStatus == OrganisationStatus.Active) .As <Organisation>() .ToList(); if (organisations.Any()) { Trace("Found {0} organisations requiring cancellation", organisations.Count); foreach (var organisation in organisations) { _suspendOrganisationCommand.Invoke(new SuspendOrganisationRequest { Reason = SuspendedReason.SubscriptionCancelled, OrganisationId = organisation.Id, Message = "Subscription cancelled by user" }); } } }