Exemplo n.º 1
0
        public ActionResult Create(GreetingViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var greeting = Mapper.Map <Greeting>(viewModel);

                    _greetingService.Insert(greeting);

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View(viewModel));
                }
            }

            return(View(viewModel));
        }