示例#1
0
        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));
            }
        }
示例#2
0
 public async Task <Greeting> Update([FromBody] Greeting greeting)
 {
     return(await _greetingService.Update(greeting));
 }