public ActionResult Create(Technology technology) { if (ModelState.IsValid) { technologyService.Insert(technology); return(RedirectToAction("Index")); } return(View(technology)); }
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)); }