public async Task <IActionResult> UpdateEmployee(int id, EmployeeForUpdateDTO employeeForUpdateDTO)
        {
            try
            {
                var _employeeFromRepo = await _repo.Read().FirstOrDefaultAsync(e => e.Id == id);

                if (_employeeFromRepo == null)
                {
                    return(NotFound(@"Employee with Id = {" + Convert.ToString(id) + "} is not found"));
                }
                _mapper.Map(employeeForUpdateDTO, _employeeFromRepo);
                await _repo.Update(_employeeFromRepo);

                return(NoContent());
            }
            catch (Exception ex)
            {
                string _errorMessage = $"Updating employee# {id} failed on save!";
                _logger.LogError(_errorMessage);
                return(BadRequest(_errorMessage));
            }
        }
        public async Task <IActionResult> UpdateEmployeeForCompany(Guid companyId, Guid id, [FromBody] EmployeeForUpdateDTO employee)
        {
            var employeeEntity = HttpContext.Items["employee"] as Employee;

            if (employeeEntity == null)
            {
                _logger.LogInfo($"Employee with id: {id} doesn't exist in the database.");
                return(NotFound());
            }

            _mapper.Map(employee, employeeEntity);

            await _repo.SaveAsync();

            return(NoContent());
        }
        public async Task <IActionResult> UpdateEmployeeForCompany(Guid companyId, Guid id, [FromBody] EmployeeForUpdateDTO
                                                                   employee)
        {
            //trackChanges allows to "record" the modifications made to that item and eventually save them to the DB
            var employeeEntity = HttpContext.Items["employee"] as Employee;



            _mapper.Map(employee, employeeEntity);//I copy employee(my DTO to be updated) to employeeEntity(in the DB)
            await _repository.SaveAsync();

            return(NoContent());
        }