public async Task <IActionResult> Edit(string id, [Bind("Id,Name,Description,MatchCondition,ReplaceWith")] DataProcessingRule dataProcessingRule)
        {
            if (id != dataProcessingRule.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dataProcessingRule);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DataProcessingRuleExists(dataProcessingRule.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dataProcessingRule));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Description,MatchCondition,ReplaceWith")] DataProcessingRule dataProcessingRule)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dataProcessingRule);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dataProcessingRule));
        }
        public ActionResult ApplyRules(MainViewModel main)
        {
            List <DataProcessingRule> rules = main.AvailableDataProcessingRules.Where(sim => sim.IsSelected == true).ToList();

            foreach (DataProcessingRule r in rules)
            {
                DataProcessingRule rule = _context.DataProcessingRule.Where(sim => sim.Id == r.Id).First();
                main.ProcessedData = main.ProcessedData.Replace(rule.MatchCondition, rule.ReplaceWith, StringComparison.CurrentCultureIgnoreCase);
            }

            return(PartialView("~/Views/Main/_DisplayProcessedData.cshtml", main));
        }