public ActionResult NewsCommentsDelete(int deleteId) { NewsComments newsComments = new NewsComments(); NewsComment newsComment = newsComments.GetNewsComment(deleteId); int newsId = 0; if (newsComment.IsNotNull()) { newsId = newsComment.NewsId; } switch (newsComments.Delete(deleteId)) { case 0: ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyDeleted); break; case 2: ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist); break; case 3: ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemUsedSomewhereElse); break; default: ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError); break; } return(RedirectToAction("NewsComments", new { id = newsId })); }
public ActionResult NewsCommentsEdit(int id) { BackEndNewsCommentsEdit backEndNewsCommentsEdit = new BackEndNewsCommentsEdit(); NewsComments newsComments = new NewsComments(); NewsComment newsComment = newsComments.GetNewsComment(id); SingleNews singleNews = new News().GetSingleNews(newsComment.NewsId, ConfigurationManager.AppSettings["AdminLanguageCode"]); if (singleNews.IsNotNull() && newsComment.IsNotNull()) { backEndNewsCommentsEdit.NewsId = newsComment.NewsId; backEndNewsCommentsEdit.NewsTitle = singleNews.NewsTitle; backEndNewsCommentsEdit.IsActive = newsComment.IsActive; backEndNewsCommentsEdit.Comment = newsComment.Comment; } else { ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist); ViewData.IsFormVisible(false); } return(View(backEndNewsCommentsEdit)); }