Esempio n. 1
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            string userInput = MyTextBox.Text;

            _bm.Add(userInput);
            MyTextBox.Clear();
            ListBoxBlogs.ItemsSource = _bm.ReadBlog();
            //ListBoxPosts.ItemsSource = _bm.ReadPost();
        }
Esempio n. 2
0
        public void AddABlog()
        {
            // arrange
            var count = _blogManager.ReadBlog().Count;

            // act
            _blogManager.Add("Hello");
            // assert
            var newCount = _blogManager.ReadBlog().Count;

            Assert.AreEqual(count + 1, newCount);
            // restore
            //*blogManager.Delete("Hello");  */
        }
Esempio n. 3
0
 public ActionResult Add(EntryModel entry)
 {
     if (!User.IsInRole("writer") && !User.IsInRole("chief"))
     {
         return Redirect("~/Home/AccessError");
     }
     if (ModelState.IsValid)
     {
         Entry newEntry;
         BlogManager db = new BlogManager();
         entry.Created = DateTime.Now;
         entry.Author = User.Identity.Name;
         newEntry = Mapper.Map<Entry>(entry);
         db.Add(newEntry);
         db.Save();
         return RedirectToAction("ViewEntry", new { id = newEntry.Id });
     }
     return View(entry);
 }
Esempio n. 4
0
 public ActionResult AddBlog(Blog blog)
 {
     blogManager.Add(blog);
     return(RedirectToAction("Index"));
 }