Exemplo n.º 1
0
        public IActionResult Create(Article article)
        {
            if (article == null)
            {
                return(NotFound("Could not create object."));
            }
            _articleRepo.Create(article);
            _articleRepo.Save();

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 2
0
        public void RepoTest()
        {
            Assert.AreEqual(1, 1);

            _userRepository.SetValidator(userValidator);
            _articleRepository.SetValidator(articleValidator);
            _authorRepository.SetValidator(authorValidator);


            _userRepository.Save(user);
            _authorRepository.Save(author);
            _articleRepository.Save(article);

            ArrayList users    = _userRepository.GetAll();
            ArrayList authors  = _authorRepository.GetAll();
            ArrayList articles = _articleRepository.GetAll();

            Assert.IsNotNull(users[0]);

            User    userResult    = (User)users[0];
            Author  authorResult  = (Author)authors[0];
            Article articleResult = (Article)articles[0];

            _userRepository.SetXMLFilename("test.xml");
            _userRepository.SaveAllToXML();

            UserRepo second = new UserRepo();

            second.SetXMLFilename("test.xml");
            second.LoadAllFromXML();

            second.SetXMLFilename("w");

//            Assert.AreEqual(Constants.StringTest, userResult.Username);
//            Assert.AreEqual(Constants.StringTest, authorResult.Name);
//            Assert.AreEqual(Constants.StringTest, articleResult.Title);
        }
Exemplo n.º 3
0
 public void Save(Article article)
 {
     _articleGenericRepository.Save(article);
 }