예제 #1
0
        public Employee Update(Employee obj)
        {
            Employee employee = db.Employees.Where(a => a.EmployeeId == obj.EmployeeId).FirstOrDefault();

            employee.FirstName = obj.FirstName;
            employee.LastName  = obj.LastName;
            employee.Telephone = obj.Telephone;
            employee.Email     = obj.Email;

            db.Entry(employee).State = EntityState.Modified;
            return(obj);
        }
        public AnnualLeave Update(AnnualLeave obj)
        {
            AnnualLeave annualLeave = db.AnnualLeaves.Where(a => a.LeaveID == obj.LeaveID).FirstOrDefault();

            annualLeave.TotalLeavePerYear = obj.TotalLeavePerYear;
            annualLeave.Year = obj.Year;
            annualLeave.EmployeeStartDate  = obj.EmployeeStartDate;
            annualLeave.EmployeeManager_Id = obj.EmployeeManager_Id;

            db.Entry(annualLeave).State = EntityState.Modified;
            return(obj);
        }
        public EmployeeLeave Update(EmployeeLeave obj)
        {
            EmployeeLeave leave = db.EmployeeLeaves.Where(a => a.EmployeeLeaveId == obj.EmployeeLeaveId).FirstOrDefault();

            leave.Authorized     = obj.Authorized;
            leave.AuthorizedBy   = obj.AuthorizedBy;
            leave.Status         = true;
            leave.AuthorizedDate = DateTime.Now.Date.Add(new TimeSpan(0, 00, 0));

            db.Entry(leave).State = EntityState.Modified;
            db.SaveChanges();
            return(obj);
        }
예제 #4
0
        public EmployeeAddress Update(EmployeeAddress obj)
        {
            EmployeeAddress employeeAddress = db.EmployeeAddresses.Where(a => a.ID == obj.ID).FirstOrDefault();

            employeeAddress.Address1 = obj.Address1;
            employeeAddress.Address2 = obj.Address2;
            employeeAddress.City     = obj.City;
            employeeAddress.Country  = obj.Country;
            employeeAddress.PostCode = obj.PostCode;

            db.Entry(employeeAddress).State = EntityState.Modified;
            db.SaveChanges();
            return(obj);
        }