public ActionResult Create(ActionType actionType, int jobId) { ICreateViewModel viewModel = null; switch (actionType) { case ActionType.EmailActionConfiguration: viewModel = new CreateEmailActionViewModel { ActionType = actionType, ActionConfiguration = new EmailActionConfiguration { JobConfigurationId = jobId } }; break; case ActionType.HipchatActionConfiguration: viewModel = new CreateHipChatActionViewModel { ActionType = actionType, ActionConfiguration = new HipchatActionConfiguration() { JobConfigurationId = jobId } }; break; default: throw new NotSupportedException(); } return(View(viewModel)); }
// TODO shall viewModelFactory be of IScopedLifetime? public RegionContainer(ICreateViewModel viewModelFactory) { if (viewModelFactory == null) { throw new ArgumentNullException("viewModelFactory", "viewModelFactory is null."); } _viewModelFactory = viewModelFactory; }
protected Region(ICreateViewModel viewModelFactory) { if (viewModelFactory == null) { throw new ArgumentNullException("viewModelFactory", "viewModelFactory is null."); } _viewModelFactory = viewModelFactory; }
public async Task <ActionResult> Edit(int?id, ActionType actionType) { ICreateViewModel viewModel = null; if (id.HasValue) { var action = await Database.ActionConfigurations.SingleOrDefaultAsync(j => j.Id == id.Value); if (action == null) { return(HttpNotFound()); } else { switch (actionType) { case ActionType.EmailActionConfiguration: viewModel = new CreateEmailActionViewModel { ActionType = actionType, ActionConfiguration = (EmailActionConfiguration)action }; break; case ActionType.HipchatActionConfiguration: viewModel = new Models.ViewModels.ActionConfiguration.CreateHipChatActionViewModel() { ActionType = actionType, ActionConfiguration = (HipchatActionConfiguration)action }; break; } return(View(viewModel)); } } else { return(RedirectToAction("Create", new { actionType = actionType })); } }
public SingleItemRegion(ICreateViewModel viewModelFactory) : base(viewModelFactory) { }
public MultiItemsRegion(ICreateViewModel viewModelFactory) : base(viewModelFactory) { }