コード例 #1
0
ファイル: departmentsController.cs プロジェクト: Abbade/Karol
        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
ファイル: EmployeesController.cs プロジェクト: jklhdd/DotNET
 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));
 }
コード例 #9
0
 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
ファイル: DaoBase.cs プロジェクト: ADCaVon/Y2ProjectHR
        //修改
        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());
        }
コード例 #11
0
 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));
 }
コード例 #13
0
 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;
 }