Example #1
0
        public ActionResult Index(TextMatchViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            model.Output = TextMatchService.FindMatches(
                model.Text ?? string.Empty,
                model.SubText ?? string.Empty);

            return View(model);
        }
Example #2
0
        public ActionResult Index(TextMatchViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            model.Output = TextMatchService.FindMatches(
                model.Text ?? string.Empty,
                model.SubText ?? string.Empty);

            return(View(model));
        }
        public IActionResult Index(TextMatchViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return this.View(model);
                }

                var indexes = TextMatchUtility.GetMatchedIndexes(model.Text, model.SubText);

                model.MatchingResult = indexes.JoinArrayIntoStringBySeparator(',');
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
            }

            return this.View(model);
        }
        public IActionResult Index()
        {
            var model = new TextMatchViewModel();

            return this.View(model);
        }