public async Task <IActionResult> PutEmployee(int id, Employee employee) { if (id != employee.Id) { return(BadRequest()); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPerson(int id, Person person) { if (id != person.Id) { return(BadRequest()); } _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.People.Any(e => e.Id == id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,EmployeesName")] Employees employees) { if (ModelState.IsValid) { db.Entry(employees).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employees)); }