コード例 #1
0
        public async Task <IActionResult> EditEmployee(int businessEntityID, [FromBody] HumanResources.Employee value)
        {
            var existing = await _db.HumanResources_Employee.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.BusinessEntityID  = value.BusinessEntityID;
            existing.NationalIDNumber  = value.NationalIDNumber;
            existing.LoginID           = value.LoginID;
            existing.OrganizationNode  = value.OrganizationNode;
            existing.OrganizationLevel = value.OrganizationLevel;
            existing.JobTitle          = value.JobTitle;
            existing.BirthDate         = value.BirthDate;
            existing.MaritalStatus     = value.MaritalStatus;
            existing.Gender            = value.Gender;
            existing.HireDate          = value.HireDate;
            existing.SalariedFlag      = value.SalariedFlag;
            existing.VacationHours     = value.VacationHours;
            existing.SickLeaveHours    = value.SickLeaveHours;
            existing.CurrentFlag       = value.CurrentFlag;
            existing.rowguid           = value.rowguid;
            existing.ModifiedDate      = value.ModifiedDate;

            _db.HumanResources_Employee.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> CreateEmployee([FromBody] HumanResources.Employee value)
        {
            _db.HumanResources_Employee.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }