public ActionResult Edit(int id, GreetingViewModel viewModel) { if (ModelState.IsValid) { try { var greeting = Mapper.Map <Greeting>(viewModel); _greetingService.Update(greeting); return(RedirectToAction("Index")); } catch { return(View(viewModel)); } } else { return(View(viewModel)); } }
public async Task <Greeting> Update([FromBody] Greeting greeting) { return(await _greetingService.Update(greeting)); }