public IActionResult Edit(NewsArticleCategoryEditViewModel viewModel) { NewsArticleCategory category = new NewsArticleCategory { ID = viewModel.NewsArticleCategory.ID, Name = viewModel.NewsArticleCategory.Name }; newsArticleCategoryService.Update(category); return(RedirectToAction("Details", viewModel)); }
public IActionResult Edit(int?id) { if (id == 0 || id == null) { return(NotFound()); } NewsArticleCategory category = newsArticleCategoryService.GetByID((int)id); if (category == null) { return(NotFound()); } NewsArticleCategoryEditViewModel viewModel = new NewsArticleCategoryEditViewModel { NewsArticleCategory = category }; return(View(viewModel)); }