public async Task <ActionResult> DeleteConfirmed(int id) { empleados empleados = await db.empleados.FindAsync(id); db.empleados.Remove(empleados); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ID,Cargo,Nombre,Apellidos,Genero,Edad")] empleados empleados) { if (ModelState.IsValid) { db.Entry(empleados).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(empleados)); }
public async Task <ActionResult> Create([Bind(Include = "ID,Cargo,Nombre,Apellidos,Genero,Edad")] empleados empleados) { if (ModelState.IsValid) { db.empleados.Add(empleados); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(empleados)); }
// GET: empleados/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } empleados empleados = await db.empleados.FindAsync(id); if (empleados == null) { return(HttpNotFound()); } return(View(empleados)); }