public async Task <ActionResult> Edit(GolferViewModel model) { try { // update logic here if (!ModelState.IsValid) { return(View(model)); } var golfer = _mapper.Map <Golfer>(model); var isSuccess = await _repo.Update(golfer); if (!isSuccess) { ModelState.AddModelError("", "Edit Golfer: Update not successfull"); return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Edit Golfer: Something went wrong"); return(View(model)); } }