Пример #1
0
        public ClientDTO ToDtoWithChildren(Client entity)
        {
            ClientDTO client = new ClientDTO()
            {
                Id            = entity.Id,
                Name          = entity.Name,
                Email         = entity.Email,
                Phone         = entity.Phone,
                Address       = entity.Address,
                TotalDebt     = entity.TotalDebt,
                AmountPayed   = entity.AmountPayed,
                Debt          = entity.Debt,
                Constructions = entity.Constructions != null?ConstructionMapper.Build().ToDtoList(entity.Constructions).ToList() : new List <ConstructionDTO>()
            };

            return(client);
        }
Пример #2
0
        public Client ToEntityWithChildren(ClientDTO dto)
        {
            Client client = new Client()
            {
                Id            = dto.Id,
                Name          = dto.Name,
                Email         = dto.Email,
                Phone         = dto.Phone,
                Address       = dto.Address,
                TotalDebt     = dto.TotalDebt,
                AmountPayed   = dto.AmountPayed,
                Constructions = dto.Constructions != null?ConstructionMapper.Build().ToEntityList(dto.Constructions).ToList() : new List <Construction>()
            };

            client = client.CalculateDebt();
            return(client);
        }
        public Employee ToEntityWithChildren(EmployeeDTO dto)
        {
            Employee Employee = new Employee()
            {
                Id            = dto.Id,
                Name          = dto.Name,
                Email         = dto.Email,
                Phone         = dto.Phone,
                Address       = dto.Address,
                DailyIncome   = dto.DailyIncome,
                DaysWorked    = dto.DaysWorked,
                Constructions = dto.Constructions != null?ConstructionMapper.Build().ToEntityList(dto.Constructions).ToList() : new List <Construction>()
            };

            Employee = Employee.CalculateIncome();
            return(Employee);
        }
        public EmployeeDTO ToDtoWithChildren(Employee entity)
        {
            entity = entity.CalculateIncome();
            EmployeeDTO employee = new EmployeeDTO()
            {
                Id            = entity.Id,
                Name          = entity.Name,
                Email         = entity.Email,
                Phone         = entity.Phone,
                Address       = entity.Address,
                DailyIncome   = entity.DailyIncome,
                DaysWorked    = entity.DaysWorked,
                TotalIncome   = entity.TotalIncome,
                Constructions = entity.Constructions != null?ConstructionMapper.Build().ToDtoList(entity.Constructions).ToList() : new List <ConstructionDTO>()
            };

            return(employee);
        }