Esempio n. 1
0
        private EmployeeDto ConvertToDto(Employee entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new EmployeeDto
            {
                Id = entity.Id,
                Name = entity.Name,
                LastName = entity.LastName,
                Patronymic = entity.Patronymic,
                ImageUrl = entity.ImageUrl,
                Department = _departmentService.Departments.First(d => d.Id == entity.Department.Id),
                Position = _departmentService.Positions.First(p => p.Id == entity.Position.Id),
                Checkouts = _checkoutService.GetByEmployeeIdAsync(entity.Id).GetAwaiter().GetResult(),
                CheckoutHistory = _checkoutService.GetEmployeeHistoryByIdAsync(entity.Id).GetAwaiter().GetResult()
            });
        }