Beispiel #1
0
 public ActionResult Delete(int id, EmployeeViewModel model)
 {
     try
     {
         _employeeService.Delete(id);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
 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();
     }
 }
Beispiel #4
0
 // GET: Employee/Create
 public ActionResult Create(int parentId)
 {
     var model = new EmployeeViewModel { StoreId = parentId };
     return View(model);
 }