public ActionResult EditDepartment([Bind(Include = "DepartmentId,Name,DateOfAdding,DateInfoChanging")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ShowDepartments")); } return(View(department)); }
public async Task <IHttpActionResult> PutDepartment(int id, Department department) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != department.DepartmentID) { return(BadRequest()); } db.Entry(department).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
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> PutDepartment(int id, Department department) { if (id != department.Id) { return(BadRequest()); } _context.Entry(department).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutWorker(int id, Worker worker) { if (id != worker.WorkerId) { return(BadRequest()); } _context.Entry(worker).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IHttpActionResult> PutEmployees(int id, Employees employees) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employees.EmployeeID) { return(BadRequest()); } db.Entry(employees).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public PartialViewResult UpdateEmployee(Employee employee) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); var departments = db.Departments; return(PartialView("_PartialIndex", departments)); }
public ActionResult Edit([Bind(Include = "DepartmentsId,DepartmentName")] Departments departments) { if (ModelState.IsValid) { db.Entry(departments).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(departments)); }
public ActionResult Edit([Bind(Include = "JobId,JobName,Salary")] Job job) { if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(job)); }
public ActionResult UpdateEmployee(Employee employee) { if (employee == null) { return(HttpNotFound()); } db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Department")); }
public ActionResult Edit([Bind(Include = "PersonId,Name,BeginDate,Grad,sex,Tecnology,Prim")] Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit([Bind(Include = "Id,EmpName,Designation,DepartmentId")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", employee.DepartmentId); return(View(employee)); }
public async Task <IActionResult> PutMeetings(int id, Meeting meeting) { if (id != meeting.Id) { return(BadRequest()); } db.Entry(meeting).State = EntityState.Modified; await db.SaveChangesAsync(); return(NoContent()); }
public async Task <IActionResult> PutEmployees(int id, Employee employee) { if (id != employee.Id) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; await db.SaveChangesAsync(); return(NoContent()); }
public ActionResult Edit(int id, EmployeeModel emp) { try { // TODO: Add update logic here DbContext.Entry(emp).State = System.Data.Entity.EntityState.Modified; DbContext.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <bool> Put(int Id, Employee department) { _context.Entry(department).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(false); } return(true); }
public bool Update(Department entity) { try { context.Entry(entity).State = EntityState.Modified; int result = context.SaveChanges(); if (result > 0) { return(true); } return(false); } catch (Exception ex) { //log throw ex; } }
public void Update(Employee t) { context.Entry <Employee>(t).State = EntityState.Modified; }
public void Update(Computer t) { context.Entry <Computer>(t).State = EntityState.Modified; }
public void Update(Organization t) { context.Entry <Organization>(t).State = EntityState.Modified; }