Example #1
0
        public ConstructionDTO ToDto(Construction entity)
        {
            ConstructionDTO dto = new ConstructionDTO()
            {
                Id       = entity.Id,
                Title    = entity.Title,
                Desc     = entity.Desc,
                Deadline = entity.Deadline,
                Cost     = entity.Cost,
                EndPrice = entity.EndPrice,
                Client   = entity.Client != null?ClientMapper.Build().ToDto(entity.Client) : new ClientDTO()
            };

            return(dto);
        }
Example #2
0
        public Construction ToEntity(ConstructionDTO dto)
        {
            Construction Construction = new Construction()
            {
                Id       = dto.Id,
                Title    = dto.Title,
                Desc     = dto.Desc,
                Deadline = dto.Deadline,
                Cost     = dto.Cost,
                EndPrice = dto.EndPrice,
                Client   = dto.Client != null?ClientMapper.Build().ToEntity(dto.Client) : new Client()
            };

            return(Construction);
        }
Example #3
0
        public ConstructionDTO ToDtoWithChildren(Construction entity)
        {
            ConstructionDTO dto = new ConstructionDTO()
            {
                Id                           = entity.Id,
                Title                        = entity.Title,
                Desc                         = entity.Desc,
                Deadline                     = entity.Deadline,
                Cost                         = entity.Cost,
                EndPrice                     = entity.EndPrice,
                Client                       = entity.Client != null?ClientMapper.Build().ToDto(entity.Client) : new ClientDTO(),
                                        Crew = entity.Crew != null?EmployeeMapper.Build().ToDtoList(entity.Crew).ToList() : new List <EmployeeDTO>()
            };

            return(dto);
        }
Example #4
0
        public Construction ToEntityWithChildren(ConstructionDTO dto)
        {
            Construction Construction = new Construction()
            {
                Id                           = dto.Id,
                Title                        = dto.Title,
                Desc                         = dto.Desc,
                Deadline                     = dto.Deadline,
                Cost                         = dto.Cost,
                EndPrice                     = dto.EndPrice,
                Client                       = dto.Client != null?ClientMapper.Build().ToEntity(dto.Client) : new Client(),
                                        Crew = dto.Crew != null?EmployeeMapper.Build().ToEntityList(dto.Crew).ToList() : new List <Employee>()
            };

            return(Construction);
        }