// GET: EmployeeInfo/Create public ActionResult Create() { var model = new EmployeeInfoCreateVM(); model.Branches = _branchManager.GetAll(); model.EmployeeInfoses = _employeeInfoManager.GetAll(); return(View(model)); }
public ActionResult Create(EmployeeInfoCreateVM model) { try { if (ModelState.IsValid) { var EmployeeInfo = Mapper.Map <EmployeeInfo>(model); bool IsSaved = _employeeInfoManager.Save(EmployeeInfo); if (IsSaved) { RedirectToAction("Create"); } } return(RedirectToAction("Create")); } catch (Exception exception) { ModelState.AddModelError("", exception.Message); model.Branches = _branchManager.GetAll(); model.EmployeeInfoses = _employeeInfoManager.GetAll(); return(View(model)); } }