Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email")] Employees employees)
        {
            if (id != employees.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employees);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeesExists(employees.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employees));
        }
        public async Task <IActionResult> Edit(string id, [Bind("JobCode,JobTtile,StartDate")] Jobs jobs)
        {
            if (id != jobs.JobCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobsExists(jobs.JobCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobs));
        }
        public async Task <IActionResult> Edit(int id, [Bind("JobAssignmentsId,JobCode,Id,AssignemtDate")] JobAssignments jobAssignments)
        {
            if (id != jobAssignments.JobAssignmentsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobAssignments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobAssignmentsExists(jobAssignments.JobAssignmentsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"]      = new SelectList(_context.Employees, "Id", "Email", jobAssignments.Id);
            ViewData["JobCode"] = new SelectList(_context.Jobs, "JobCode", "JobCode", jobAssignments.JobCode);
            return(View(jobAssignments));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Password,Type")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }