public async Task <IActionResult> Edit(TagViewModel tagViewModel) { if (ModelState.IsValid) { var tag = new Tag() { Id = tagViewModel.Id, Name = tagViewModel.Name, Slug = tagViewModel.Slug, Content = tagViewModel.Content, }; try { var result = await _tagServices.UpdateAsync(tag); if (result) { return(RedirectToAction(nameof(Index))); } } catch (NullReferenceException) { return(NotFound()); } catch (Exception) { return(BadRequest()); } } return(View(tagViewModel)); }