Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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());
        }
Пример #4
0
 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));
 }
Пример #5
0
 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));
 }
Пример #6
0
 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));
 }
Пример #7
0
 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));
 }
Пример #8
0
 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));
 }
Пример #10
0
        //修改
        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;
     }
 }
Пример #12
0
 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;
 }
Пример #14
0
 public async Task <int> Update(T entity)
 {
     _context.Entry(entity).State = EntityState.Modified;
     return(await _context.SaveChangesAsync());
 }
Пример #15
0
 public void Update(Position item)
 {
     hRContext.Entry(item).State = System.Data.Entity.EntityState.Modified;
 }
Пример #16
0
 public void Update(Department item)
 {
     hRContext.Entry(item).State = EntityState.Modified;
 }