public IActionResult Edit(PostEditVm postVm) { if (!ModelState.IsValid) { return(View()); } try { _postService.UpdatePost(postVm); return(RedirectToAction("Index")); } catch (BusinessRoleException ex) { ModelState.AddModelError("", ex.Message); return(View()); } catch (Exception ex) { ViewData["Erro"] = ex.Message; return(View("_Erro")); } }
public void UpdatePost(PostEditVm postVm) { this._repository.Update(mapper.Map <Post>(postVm)); }