public Worker Convert(WorkerBO _worker)
        {
            if (_worker != null)
            {
                var worker = new Worker
                {
                    Id         = _worker.Id,
                    Name       = _worker.Name,
                    Surname    = _worker.Surname,
                    MiddleName = _worker.MiddleName,
                    Position   = _worker.Position
                };

                if (_worker.Tasks != null)
                {
                    var taskBoToDalConverter = new TaskBOConverter();
                    var tempTasks            = new List <Task>();

                    foreach (var task in _worker.Tasks)
                    {
                        var _task = taskBoToDalConverter.Convert(task);
                        _task.Project   = null;
                        _task.Executors = null;
                        tempTasks.Add(_task);
                    }
                    worker.Tasks = tempTasks;
                }

                return(worker);
            }

            return(null);
        }
Exemplo n.º 2
0
        public Project Convert(ProjectBO _project)
        {
            if (_project != null)
            {
                var project = new Project
                {
                    Id           = _project.Id,
                    Name         = _project.Name,
                    Shortname    = _project.Shortname,
                    Description  = _project.Description,
                    Status       = _project.Status,
                    CreationDate = _project.CreationDate
                };

                if (_project.Tasks != null)
                {
                    var taskBoToDalConverter = new TaskBOConverter();
                    var tempTasks            = new List <Task>();

                    foreach (var task in _project.Tasks)
                    {
                        var _task = taskBoToDalConverter.Convert(task);
                        _task.Project   = null;
                        _task.Executors = null;
                        tempTasks.Add(_task);
                    }
                    project.Tasks = tempTasks;
                }

                return(project);
            }

            return(null);
        }