public ActionResult Submit(string tweet)
        {
            PhraseHelper helper = new PhraseHelper();
            
            string[] verbotenPhrases = helper.GetPhrases().Select(x => x.phrase).ToArray();
            string[] words = tweet.Split(new char[] { ' ' });
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < words.Length; i++)
            {
                int index = Array.IndexOf(verbotenPhrases, words[i].ToLower());
                if (index != -1)
                {
                    sb.Append(words[i]);
                }
            }

            Log.Logger = logger;
            if (sb.Length > 0)
            {
                
                Log.Information("tweet containing problematic phrases {phrase} denied to submit", sb);
                ViewData["Message"] = "tweet does contain problematic phrases";
                ViewData["Words"] = sb;
            }
            else
            {
                Log.Information("a new tweet submitted without any problematic phrases");
                ViewData["Message"] = "tweet does not contain any problematic phrases";
            }
            return View("TweetResult");
        }
 // GET: Phrase
 public ActionResult Index()
 {
     PhrasesListViewModel phListVM = new PhrasesListViewModel();
     PhraseHelper helper = new PhraseHelper();
     phListVM.Phrases = helper.GetPhrases();
     return View("ProblematicPhrases", phListVM);
 }
        public ActionResult Add(Phrase p)
        {
            PhraseHelper helper = new PhraseHelper();
            helper.SavePhrase(p);
            ViewData["Message"] = "phrase " + p.phrase + " is successfully added";

            Log.Logger = logger;
            Log.Information("Added phrase {phrase}", p.phrase);

            return View("AddNewPhrase");
        }
        public ActionResult Delete(int pID)
        {
            PhraseHelper helper = new PhraseHelper();
            helper.DeletePhraseByID(pID);
            
            Log.Logger = logger;
            Log.Information("Deleted phrase");

            PhrasesListViewModel phListVM = new PhrasesListViewModel();
            phListVM.Phrases = helper.GetPhrases();
            return View("ProblematicPhrases", phListVM);
        }
        public ActionResult Update(string phrase, int pID)
        {
            PhraseHelper helper = new PhraseHelper();
            Phrase p = new Phrase
            {
                phrase = phrase,
                PhraseID = pID
            };
            helper.UpdatePhrase(p);

            //ILogger logger = new LoggerConfiguration().WriteTo.File("c:\\logs\\logfile2.txt").CreateLogger();
            Log.Logger = logger;
            Log.Information("Updated phrase {phrase}", phrase);

            PhrasesListViewModel phListVM = new PhrasesListViewModel();            
            phListVM.Phrases = helper.GetPhrases();
            return View("ProblematicPhrases", phListVM);
        }
 public ActionResult Edit(int pID)
 {
     PhraseHelper helper = new PhraseHelper();
     Phrase p = helper.GetPhraseByID(pID);
     return View("EditPhrase", p);
 }