public async Task <IActionResult> Edit(int id) { var vm = new CreateAndEditArticleViewModel(); if (id > 0) { var article = await _articleManager.FindByIdAsync(id); if (article != null) { vm.Id = article.Id; vm.Title = article.Title; vm.Content = Base64.base64Encode(article.Content); vm.Description = article.Description; vm.Source = article.Source; vm.CoverImg = article.CoverImg; vm.CategoryName = article.CategoryName; vm.Status = article.Status; } } ViewData["Categorys"] = GetCategorys(); return(View(vm)); }