public ActionResult Delete(int id, EmployeeViewModel model) { try { _employeeService.Delete(id); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(EmployeeViewModel model) { if (ModelState.IsValid) { var employee = Mapper.Map(model, new Employee()); _employeeService.CreateForStore(employee, model.StoreId); return RedirectToAction("Index", "Store", new { id = model.Id }); } else { return View(); } }
public ActionResult Edit(int id, EmployeeViewModel model) { if (ModelState.IsValid) { var employee = _employeeService.GetById(id); Mapper.Map(model, employee); _employeeService.Update(employee); return RedirectToAction("Details", "Store", new { id = model.Id }); } else { return View(); } }
// GET: Employee/Create public ActionResult Create(int parentId) { var model = new EmployeeViewModel { StoreId = parentId }; return View(model); }