public async Task <IActionResult> Edit(int id, [Bind("CostId,DailyRate,EmployeeNumber,HourlyRate,MonthlyIncome,MonthlyRate,OverTime,PercentSalaryHike,StandardHours")] EmployeeCost employeeCost)
        {
            if (id != employeeCost.CostId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeCost);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeCostExists(employeeCost.CostId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetails, "EmployeeNumber", "EmployeeNumber", employeeCost.EmployeeNumber);
            return(View(employeeCost));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DetailId,Age,Attrition,Department,DistanceFromHome,Education,EducationField,EmployeeNumber,Gender,MaritalStatus,Over18")] EmployeeDetails employeeDetails)
        {
            if (id != employeeDetails.EmployeeNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeDetailsExists(employeeDetails.EmployeeNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeDetails));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("JobId,BusinessTravel,Department,EmployeeNumber,JobInvolvement,JobLevel,JobRole")] JobInformation jobInformation)
        {
            if (id != jobInformation.JobId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobInformation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobInformationExists(jobInformation.JobId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetails, "EmployeeNumber", "EmployeeNumber", jobInformation.EmployeeNumber);
            return(View(jobInformation));
        }