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 CancelSubscription(CancelSubscriptionPostModel model) { if (!Core.Configuration.SubscriptionsEnabled) { ConfirmationNotification("Errordite subscriptions are not currently enabled, you may continue using the free trial until subscriptions become active."); return(RedirectToAction("index")); } var response = _cancelSubscriptionCommand.Invoke(new CancelSubscriptionRequest { CurrentUser = Core.AppContext.CurrentUser, CancellationReason = model.CancellationReason }); if (response.Status == CancelSubscriptionStatus.Ok) { ConfirmationNotification("Your subscription has been cancelled, your account will become inactive on {0}.".FormatWith(response.AccountExpirationDate.ToLocalFormatted())); return(RedirectToAction("index")); } return(RedirectWithViewModel(model, "cancel", response.Status.MapToResource(Resources.Subscription.ResourceManager))); }