public ActionResult EditArticle(EditArticleViewModel editArticleViewModel) { if (ModelState.IsValid) { IArticleBLL articleBLL = new ArticleBLL(); List <Guid> categoryIds = new List <Guid>(); foreach (string categoryId in editArticleViewModel.CategoryIds) { categoryIds.Add(Guid.Parse(categoryId)); } articleBLL.EditArticle(editArticleViewModel.ArticleId, editArticleViewModel.Title, editArticleViewModel.Content, categoryIds.ToArray()); return(RedirectToAction("ArticleList2")); } else { var userId = Guid.Parse(Session["loginUserId"].ToString()); ViewBag.CategoryIds = new ArticleBLL().GetAllCategories(userId); return(View(editArticleViewModel)); } }