public IActionResult EditArticle([FromRoute] Guid articleId, [FromBody] ArticleEditDto articleEditDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            _articleLogic.EditArticle(articleEditDto, articleId);

            return(NoContent());
        }
Beispiel #2
0
        public void EditArticle()
        {
            //Arrange
            IArticleLogic logic         = LogicFactory.CreateArticleMemoryLogic();
            Article       article       = logic.GetCurrentArticle(3);
            Article       editedArticle = logic.GetCurrentArticle(2);

            article = logic.EditArticle(editedArticle);

            //Act
            Article expected = editedArticle;
            Article actual   = article;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public ActionResult EditArticle(ArticleViewModel articleViewModel)
        {
            try
            {
                Article EditedArticle = new Article();
                EditedArticle = articleViewModel.Article;
                logic.EditArticle(EditedArticle);

                Session["EditedArticle"] = EditedArticle;
                return(RedirectToAction("EditFile", "File", new { es = EditedArticle }));
            }
            catch (SqlException sqlException)
            {
                return(View("Error", sqlException));
            }
            catch (InvalidCastException invalidCastException)
            {
                return(View("Error", invalidCastException));
            }
        }