public IHttpActionResult PutDEPARTMENTS(int id, DEPARTMENTS dEPARTMENTS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dEPARTMENTS.DEPARTMENT_ID) { return(BadRequest()); } db.Entry(dEPARTMENTS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DEPARTMENTSExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutEMPLOYEES(int id, EMPLOYEES eMPLOYEES) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eMPLOYEES.MANAGER_ID) { return(BadRequest()); } db.Entry(eMPLOYEES).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EMPLOYEESExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public int Salary_standardUpdate(Salary_standardModel ssm) { Salary_standard ss = new Salary_standard() { ssd_id = ssm.ssd_id, standard_id = ssm.standard_id, standard_name = ssm.standard_name, designer = ssm.designer, register = ssm.register, checker = ssm.checker, changer = ssm.changer, regist_time = ssm.regist_time, check_time = ssm.check_time, change_time = ssm.change_time, salary_sum = ssm.salary_sum, check_status = ssm.check_status, change_status = ssm.change_status, check_comment = ssm.check_comment, remark = ssm.remark, }; hr.Salary_standard.Attach(ss); hr.Entry(ss).State = System.Data.Entity.EntityState.Modified; return(hr.SaveChanges()); }
public ActionResult Edit([Bind(Include = "Id,Name")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "ID,Name")] Role role) { if (ModelState.IsValid) { db.Entry(role).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(role)); }
public ActionResult Edit([Bind(Include = "Id,Name,Address,DepartmentId")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId); return(View(employee)); }
public ActionResult Edit([Bind(Include = "ID,FirstName,LastName,Email,CityID")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityID = new SelectList(db.Cities, "ID", "Name", user.CityID); return(View(user)); }
public ActionResult Edit([Bind(Include = "EmployeeId,FirstName,MiddleName,LastName,DOB,Position,DepartmentId")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Department, "DepartmentId", "DepartmentName", employee.DepartmentId); return(View(employee)); }
public ActionResult Edit([Bind(Include = "ID,ChildRoleID,ParentRoleID")] RoleHierarchy roleHierarchy) { if (ModelState.IsValid) { db.Entry(roleHierarchy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChildRoleID = new SelectList(db.Roles, "ID", "Name", roleHierarchy.ChildRoleID); ViewBag.ParentRoleID = new SelectList(db.Roles, "ID", "Name", roleHierarchy.ParentRoleID); return(View(roleHierarchy)); }
//修改 public int Update(T t, params string[] ps) { FenLi(t); // odb.Detach() db.Set <T>().Attach(t); // db.Entry(t).State = System.Data.Entity.EntityState.Unchanged; foreach (string item in ps) { db.Entry(t).Property(item).IsModified = true; } return(db.SaveChanges()); }
public void InsertOrUpdate(Employee employee) { if (employee.Id == default(int)) { // New entity context.Employees.Add(employee); } else { // Existing entity context.Entry(employee).State = EntityState.Modified; } }
public ActionResult Edit([Bind(Include = "ID,UserID,BossEmployeeID,RoleID,ProjectID,SalaryAmount")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BossEmployeeID = new SelectList(db.Employees, "ID", "ID", employee.BossEmployeeID); ViewBag.ProjectID = new SelectList(db.Projects, "ID", "Name", employee.ProjectID); ViewBag.RoleID = new SelectList(db.Roles, "ID", "Name", employee.RoleID); ViewBag.UserID = new SelectList(db.Users, "ID", "FirstName", employee.UserID); return(View(employee)); }
public void Update(EmployeeToProject item) { hRContext.Entry(item).State = System.Data.Entity.EntityState.Modified; }
public async Task <int> Update(T entity) { _context.Entry(entity).State = EntityState.Modified; return(await _context.SaveChangesAsync()); }
public void Update(Position item) { hRContext.Entry(item).State = System.Data.Entity.EntityState.Modified; }
public void Update(Department item) { hRContext.Entry(item).State = EntityState.Modified; }