public async Task<IActionResult> PutProducts(int id, Products products) { if (id != products.ProductId) { return BadRequest(); } _context.Entry(products).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
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)); }
public async Task <IActionResult> Create([Bind("DeptId,DeptName")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("IdAlumno,Nombre,ApPaterno,ApMaterno,Email,BanActivo")] Alumno alumno) { if (ModelState.IsValid) { _context.Add(alumno); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(alumno)); }
public async Task <IActionResult> Create([Bind("IdColonia,IdDelMun,Nombre")] Colonia colonia) { if (ModelState.IsValid) { _context.Add(colonia); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdDelMun"] = new SelectList(_context.DelegacionMunicipio, "IdDelMun", "IdDelMun", colonia.IdDelMun); return(View(colonia)); }