/// <summary> /// Adds <see cref="Atomia.Store.AspNetMvc.Models.OrderFlowModel"/> to ViewBag. /// </summary> private void PopulateViewBag(ActionExecutingContext filterContext, OrderFlow orderFlow, OrderFlowStep currentStep, bool isQueryStringBased) { var resourceProvider = DependencyResolver.Current.GetService <IResourceProvider>(); var orderFlowModel = new OrderFlowModel { IsQueryStringBased = isQueryStringBased, Name = orderFlow.Name, Steps = orderFlow.Steps.Select(s => new OrderFlowStepModel { Name = s.Name, Previous = s.Previous, Next = s.Next, StepNumber = s.StepNumber, Title = resourceProvider.GetResource("StepTitle" + s.Name), Description = resourceProvider.GetResource("StepDescription" + s.Name) }), CurrentStep = new OrderFlowStepModel { Name = currentStep.Name, Previous = currentStep.Previous, Next = currentStep.Next, StepNumber = currentStep.StepNumber, Title = resourceProvider.GetResource("StepTitle" + currentStep.Name), Description = resourceProvider.GetResource("StepDescription" + currentStep.Name) } }; filterContext.Controller.ViewBag.OrderFlow = orderFlowModel; }
public static void RegisterOrderFlows(OrderFlowCollection orderFlows) { var defaultOrderFlow = new OrderFlow("DefaultFlow", new[] { "Domains", "HostingPackage", "Account", "Checkout" }); // Alias Default to Domains, to match Default route setup. defaultOrderFlow.AddRouteNameAlias("OrderFlowStart", "Domains"); orderFlows.Add(defaultOrderFlow, true); }
/// <summary> /// Get <see cref="OrderFlow"/> with name from query string. /// </summary> private OrderFlow GetOrderFlowFromQueryString(System.Web.HttpRequestBase request) { var orderFlowName = request.QueryString["flow"] as string; OrderFlow orderFlow = null; if (!String.IsNullOrEmpty(orderFlowName)) { orderFlow = GlobalOrderFlows.OrderFlows.GetOrderFlow(orderFlowName); } return(orderFlow); }
/// <summary> /// Validates <see cref="Atomia.Store.AspNetMvc.Models.OrderFlowModel"/> for current step. /// </summary> private void ValidateOrderFlowStep(ActionExecutingContext filterContext, OrderFlow orderFlow, OrderFlowStep currentOrderFlowStep) { var orderFlowValidator = DependencyResolver.Current.GetService <IOrderFlowValidator>(); var validationMessages = orderFlowValidator.ValidateOrderFlowStep(orderFlow, currentOrderFlowStep); if (validationMessages.Count() > 0) { // TODO: Make messages available to next controller via flash message provider filterContext.Result = new RedirectToRouteResult(currentOrderFlowStep.Previous, new RouteValueDictionary()); } }
public void Add(OrderFlow entity) { context.OrderFlow.Add(entity); context.SaveChanges(); }