//        public async Task<IActionResult> PutEmployees(int id, Employees employees)
        public async Task <IActionResult> PutEmployees(Employees employees)
        {
            //if (id != employees.EmployeeId)
            //{
            //    return BadRequest();
            //}

            _context.Entry(employees).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                //if (!EmployeesExists(id))
                if (!EmployeesExists(employees.EmployeeId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
//        public async Task<IActionResult> PutDepartments(int id, Departments departments)
        public async Task <IActionResult> PutDepartments(Departments departments)
        {
            //if (id != departments.DepartmentId)
            //{
            //    return BadRequest();
            //}

            _context.Entry(departments).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                //if (!DepartmentsExists(id))
                if (!DepartmentsExists(departments.DepartmentId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }