/// <summary> /// Gets the data. /// </summary> /// <returns>The data from this view model</returns> public IGenericInput GetData() { var returnValue = new TextInputModel { Input = this.Input, Label = this.Label, }; return(returnValue); }
/// <summary> /// Rendert eine Textbox im Bootstrap-Stil für das übergebene Property. /// </summary> /// <returns></returns> public MvcHtmlString TextBox <TProperty>(Expression <Func <TModel, TProperty> > expression, string placeholder = null, string label = null, string formatString = null) { ModelMetadata modelMetadata = ModelMetadata.FromLambdaExpression(expression, Helper.ViewData); TextInputModel textInputModel = new TextInputModel(Helper, modelMetadata, ExpressionHelper.GetExpressionText(expression), label, placeholder); return(Helper.Partial("EditorTemplates/Forms/Input", textInputModel)); }
public MainPresenter CreateMainPresenter() { ToolbarView toolbarView = new ToolbarView(); TextInputView textInputView = new TextInputView(); WordCounterView wordCounterView = new WordCounterView(); StatusBarView statusBarView = new StatusBarView(); ToolbarModel toolbarModel = new ToolbarModel(); //ToolbarPresenter toolbarPresenter = new ToolbarPresenter(toolbarView, toolbarModel); IModalDialogBuilder modalDialogBuilder = new ModalDialogBuilder(); IFileSelectionView fileSelectionView = new FileSelectionView(); FileSelectionModel fileSelectionModel = new FileSelectionModel(); FileSelectionPresenter openFilePresenter = new FileSelectionPresenter(fileSelectionView, fileSelectionModel); TextInputModel textInputModel = new TextInputModel(fileSelectionModel); TextInputPresenter textInputPresenter = new TextInputPresenter(textInputView, textInputModel); WordFrequencyCounter wordFrequencyCounter = new WordFrequencyCounter(); WordCounterModel wordCounterModel = new WordCounterModel(wordFrequencyCounter); WordCounterPresenter wordCounterPresenter = new WordCounterPresenter(wordCounterView, wordCounterModel); RunButtonNavigator runButtonNavigator = new RunButtonNavigator(toolbarView, wordCounterModel); MainView mainView = new MainView(toolbarView, textInputView, wordCounterView, statusBarView); MainModel mainModel = new MainModel(); MainPresenter mainPresenter = new MainPresenter(mainView, mainModel); AboutView aboutView = new AboutView(); AboutModel aboutModel = new AboutModel(); AboutPresenter aboutPresenter = new AboutPresenter(aboutView, aboutModel); RunButtonNavigator navigation = new RunButtonNavigator(toolbarView, wordCounterModel); AboutButtonNavigator aboutButtonNavigator = new AboutButtonNavigator(toolbarView, aboutView); TextSynchronizer modelConnector = new TextSynchronizer(wordCounterModel, textInputModel); IFileSelectionDisplay fileSelectionDisplay = new FileSelectionDisplay(fileSelectionModel); ILoadTextFromFile loadTextFromFile = new LoadTextFromFile(fileSelectionDisplay); LoadTextFromFileToTextInput loadTextFromFileToTextInput = new LoadTextFromFileToTextInput(loadTextFromFile, textInputModel); FileSelectionNavigator openFileButtonNavigator = new FileSelectionNavigator(toolbarView, loadTextFromFileToTextInput); TextInputLoader textInputLoader = new TextInputLoader(textInputModel, fileSelectionModel); /* * Wyświetlanie MsgBox * Obsługa błędów otwarcia pliku */ return(mainPresenter); }
public ActionResult EnterText(TextInputModel model) { if (string.IsNullOrWhiteSpace(model.Text)) { return this.View(); } var blobName = Guid.NewGuid().ToString(); var blob = this.blobContainer.GetBlockBlobReference(blobName); blob.UploadText(model.Text.Trim()); var textEntity = new TextEntity(this.User.Identity.GetUserId(), blobName); this.textsTable.Execute(TableOperation.InsertOrReplace(textEntity)); this.queue.AddMessage(new CloudQueueMessage(blobName)); return this.RedirectToAction("MyTexts"); }
public void WhenTextInputInvoked_ThenViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new TextInput(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; TextInputModel resultModel = (TextInputModel)result.ViewData.Model; //Assert value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }
public void GenerateStatistics_ReturnValue() { //Given var input = new TextInputModel() { File = new HttpPostedFileBase() { file } }; // When var result = textController.GenerateStatistics(input); // Then Assert.IsNotNull(result); }
public ActionResult Sort(TextInputModel text, SortOptionInputModel sortOption) { if (!ModelState.IsValid) { return(GetErrorResponse()); } SortParameters parameters = new SortParameters() { Text = GetText(text.File), SortOptions = sortOption.SortOptions, Asc = sortOption.Asc }; var order = sortService.SortText(parameters); return(Json(order)); }
public ActionResult GenerateStatistics(TextInputModel text) { if (!ModelState.IsValid) { return(GetErrorResponse()); } StatisticParameters parameters = new StatisticParameters() { Text = GetText(text.File) }; var statistic = this.statisticService.GetStatistic(parameters); var textStatistics = new TextStatisticsResultModel() { Hyphens = statistic.Hyphens, Spaces = statistic.Spaces, Words = statistic.Words }; return(Json(textStatistics)); }