public ActionResult Create(Technology technology)
 {
     if (ModelState.IsValid)
     {
         technologyService.Insert(technology);
         return(RedirectToAction("Index"));
     }
     return(View(technology));
 }
예제 #2
0
        public ActionResult Create(TechnologyViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var entity = Mapper.Map <TechnologyViewModel, Technology>(viewModel);

                    _technologyService.Insert(entity);

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
            }

            return(View(viewModel));
        }