Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("DeptId,DeptName")] Department department)
        {
            if (id != department.DeptId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.DeptId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
        public async Task <IActionResult> Edit(long id, [Bind("IdAlumno,Nombre,ApPaterno,ApMaterno,Email,BanActivo")] Alumno alumno)
        {
            if (id != alumno.IdAlumno)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(alumno);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AlumnoExists(alumno.IdAlumno))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(alumno));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EmpId,EmpName,EmpAge,EmpGender,DeptId,EmpEmail,EmpPhoto")] Employee employee)
        {
            if (id != employee.EmpId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmpId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeptId"] = new SelectList(_context.Department, "DeptId", "DeptName", employee.DeptId);
            return(View(employee));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(long id, [Bind("IdColonia,IdDelMun,Nombre")] Colonia colonia)
        {
            if (id != colonia.IdColonia)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(colonia);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColoniaExists(colonia.IdColonia))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdDelMun"] = new SelectList(_context.DelegacionMunicipio, "IdDelMun", "IdDelMun", colonia.IdDelMun);
            return(View(colonia));
        }