public async Task <IActionResult> EditPastPosition(PastPosition position, int id) { PastPosition position1 = await _payrollDb.PastPositions.FindAsync(id); if (ModelState.IsValid) { if (position1 != null) { position1.PositionName = position.PositionName; position1.PositionSalary = position.PositionSalary; position1.DepartmentId = position.DepartmentId; position1.CompanyId = position.CompanyId; await _payrollDb.SaveChangesAsync(); return(RedirectToAction(nameof(ListPastPosition))); } else { return(Redirect("~/Account/Error")); } } else { return(View()); } }
public async Task <IActionResult> CreatePastPosition(PastPosition position) { if (ModelState.IsValid) { PastPosition p = position; await _payrollDb.PastPositions.AddAsync(p); await _payrollDb.SaveChangesAsync(); return(RedirectToAction(nameof(ListPastPosition))); } else { return(View()); } }