// GET: Employee/Edit/5 public async Task <IActionResult> Self(string id) { var resopnse = await _EmployeeSelfReferenceService.Handle(new EmployeeSelfReferenceRequest(id)); TempData["HumanType"] = HumanType; return(View(EmployeeViewModelFactory.ToSelfViewModle(resopnse))); }
public IActionResult Create(string returnUrl) { if (String.IsNullOrEmpty(returnUrl)) { returnUrl = Request.Headers["Referer"].ToString(); } return(View("Edit", EmployeeViewModelFactory.Create(new EmployeeDto(), returnUrl, EmployeeDepartments))); }
public async Task <IActionResult> Delete(int id) { var returnUrl = Request.Headers["Referer"].ToString(); var employee = await _employeeRepo.GetEmployee(id); EmployeeViewModel employeeVm = EmployeeViewModelFactory.Delete(employee, returnUrl, EmployeeDepartments); return(View("Edit", employeeVm)); }
// GET: Employee/Edit/5 public async Task <IActionResult> Family(string id) { EmployeeFamilyReferenceResponse resopnse = await _EmployeeFamilyReferenceService.Handle( new EmployeeFamilyReferenceRequest() { EmployeeId = id }); TempData["HumanType"] = HumanType; return(View(EmployeeViewModelFactory.ToFamilyViewModel(resopnse))); }
public async Task <IActionResult> Edit(int id, string returnUrl = null) { if (String.IsNullOrEmpty(returnUrl)) { returnUrl = Request.Headers["Referer"].ToString(); } var employee = await _employeeRepo.GetEmployee(id); EmployeeViewModel employeeVm = EmployeeViewModelFactory.Edit(employee, returnUrl, EmployeeDepartments); return(View("Edit", employeeVm)); }
public async Task <IActionResult> Edit([FromForm] EmployeeViewModel employeeVM) { if (ModelState.IsValid) { await _employeeRepo.UpdateEmployee(employeeVM.Employee); TempData["message"] = "Your data has been updated successfully."; TempData["toasterType"] = ToasterType.success; return(RedirectToAction(nameof(Edit), new { id = employeeVM.Employee.Id, returnUrl = employeeVM.ReturnUrl })); } else { TempData["message"] = "A problem has been ocurred while updating your data."; TempData["toasterType"] = ToasterType.info; } return(View("Edit", EmployeeViewModelFactory.Edit(employeeVM.Employee, employeeVM.ReturnUrl, EmployeeDepartments))); }
public async Task <IActionResult> Create([FromForm] EmployeeViewModel employeeVm) { if (ModelState.IsValid) { employeeVm.EmployeeDepartment = default; var newEmployee = await _employeeRepo.AddEmployee(employeeVm.Employee); TempData["message"] = "Your data has been submitted successfully."; TempData["toasterType"] = ToasterType.success; //return RedirectToAction(nameof(Index)); return(RedirectToAction(nameof(Edit), new { id = newEmployee.Id, returnUrl = employeeVm.ReturnUrl })); } TempData["message"] = "A problem has been ocurred while submitting your data."; TempData["toasterType"] = ToasterType.info; return(View("Edit", EmployeeViewModelFactory.Create(employeeVm.Employee, employeeVm.ReturnUrl, EmployeeDepartments))); }
// GET: Employee/Details/5 public async Task <IActionResult> Details(string id) { var responce = await _EmployeeDetailReferenceService.Handle(new EmployeeDetailReferenceRequest(id)); return(View(EmployeeViewModelFactory.ToDetailViewModel(responce))); }
// GET: Employee public async Task <IActionResult> Index() { EmployeeListResponse responce = await _EmployeeListService.HandleAsync(new EmployeeListRequest()); return(View(EmployeeViewModelFactory.ToListViewModel(responce))); }