Ejemplo n.º 1
0
 public void UpdatePhrase(Phrase p)
 {
     TweetDAL dal = new TweetDAL();
     Phrase ph = dal.Phrases.Where(x => x.PhraseID == p.PhraseID).FirstOrDefault();
     ph.phrase = p.phrase;
     dal.SaveChanges();
 }
Ejemplo n.º 2
0
 public Phrase SavePhrase(Phrase p)
 {
     TweetDAL dal = new TweetDAL();
     dal.Phrases.Add(p);
     dal.SaveChanges();
     return p;
 }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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);
        }