Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmpNumber,EnvironmentSat,JobSat,RelationshipSat,WorkLifeBalance,EmpId")] EmployeePerf employeePerf)
        {
            if (id != employeePerf.EmpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeePerf);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeePerfExists(employeePerf.EmpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", employeePerf.EmpNumber);
            return(View(employeePerf));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("EmpNumber,EnvironmentSat,JobSat,RelationshipSat,WorkLifeBalance,EmpId")] EmployeePerf employeePerf)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeePerf);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpNumber"] = new SelectList(_context.PrimaryTables, "EmpNumber", "EmpNumber", employeePerf.EmpNumber);
            return(View(employeePerf));
        }