Ejemplo n.º 1
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(IEnumerable <string> ids)
        {
            var ls = new List <TalentSnapshotViewModel>();

            foreach (string i in ids)
            {
                var profile = await _userRepository.GetByIdAsync(i);

                if (profile != null)
                {
                    var result = new TalentSnapshotViewModel
                    {
                        Id       = profile.Id,
                        Name     = profile.FirstName + ' ' + profile.LastName,
                        PhotoId  = profile.ProfilePhotoUrl,
                        VideoUrl = string.IsNullOrWhiteSpace(profile.VideoName)
                         ? ""
                         : await _fileService.GetFileURL(profile.VideoName, FileType.UserVideo),
                        CVUrl             = profile.CvName,
                        Visa              = profile.VisaStatus,
                        Skills            = profile.Skills.Select(x => x.Skill).ToList(),
                        LinkedAccounts    = profile.LinkedAccounts,
                        CurrentEmployment = profile.Experience.Select(x => ViewModelFromExperience(x)).FirstOrDefault().Company,
                    };
                    ls.Add(result);
                }
                ;
            }
            return(ls);
        }
Ejemplo n.º 2
0
        private TalentSnapshotViewModel BuildTalentSnapshot(User user)
        {
            String        name   = String.Format("{0} {1}", user.FirstName, user.LastName);
            List <string> skills = user.Skills.Select(x => x.Skill).ToList();
            //string photo = await _documentService.GetFileURL(user.ProfilePhoto, FileType.ProfilePhoto);

            UserExperience latest = user.Experience.OrderByDescending(x => x.End).FirstOrDefault();
            String         level, employment;

            if (latest != null)
            {
                level      = latest.Position;
                employment = latest.Company;
            }
            else
            {
                level      = "Unknown";
                employment = "Unknown";
            }

            var result = new TalentSnapshotViewModel
            {
                CurrentEmployment = employment,
                Id      = user.Id,
                Level   = level,
                Name    = name,
                PhotoId = user.ProfilePhotoUrl,
                Skills  = skills,
                Summary = user.Summary,
                Visa    = user.VisaStatus
            };

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetFullTalentList()
        {
            List <TalentSnapshotViewModel> talents = new List <TalentSnapshotViewModel>();
            List <User> ls = (await _userRepository.Get(_ => true)).ToList();

            foreach (var profile in ls)
            {
                var result = new TalentSnapshotViewModel
                {
                    Id       = profile.Id,
                    Name     = profile.FirstName + ' ' + profile.LastName,
                    PhotoId  = profile.ProfilePhotoUrl,
                    VideoUrl = string.IsNullOrWhiteSpace(profile.VideoName)
                         ? ""
                         : await _fileService.GetFileURL(profile.VideoName, FileType.UserVideo),
                    CVUrl             = profile.CvName,
                    Visa              = profile.VisaStatus,
                    Skills            = profile.Skills.Select(x => x.Skill).ToList(),
                    LinkedAccounts    = profile.LinkedAccounts,
                    CurrentEmployment = profile.Experience.OrderByDescending(s => s.End).Select(x => ViewModelFromExperience(x)).FirstOrDefault().Company,
                    Position          = profile.Experience.OrderByDescending(s => s.End).Select(x => ViewModelFromExperience(x)).FirstOrDefault().Position,
                };
                talents.Add(result);
            }
            return(talents);
        }
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            //Your code here;
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                var talentList = _userRepository.GetQueryable().Skip(position).Take(increment).AsEnumerable();
                if (profile != null)
                {
                    var result = new List <TalentSnapshotViewModel>();

                    //line 527
                    //foreach (var item in talentList)
                    {
                        var newItem = new TalentSnapshotViewModel();
                        //newItem.Id = item.Id;


                        // more lines assigning data
                        result.Add(newItem);
                    }
                    return(result);
                }
                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        //Module 2----------------------------------------------------------------------------------------------------------------------

        //Original
        //public async Task<List<User>> GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        //{

        //    throw new NotImplementedException();
        //}


        //After Edited----------------------------------------------------------------------------------------------------------------------
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerId, bool forJob, int position, int increment)
        {
            //_userRepository.Collection;
            if (employerId != null)
            {
                var list = _userRepository.GetQueryable().Skip(increment * (position - 1)).Take(increment);

                var result = new List <TalentSnapshotViewModel>();

                foreach (var user in list)
                {
                    var newUser = new TalentSnapshotViewModel();
                    newUser.Id      = user.Id;
                    newUser.Name    = user.LastName;
                    newUser.Summary = user.Summary;

                    result.Add(newUser);
                }

                return(result);
            }
            return(null);



            //throw new NotImplementedException();
        }
        public async Task <IActionResult> GetTalent()
        {
            string   id      = "";
            Employer profile = null;

            string userId = String.IsNullOrWhiteSpace(id) ? _userAppContext.CurrentUserId : id;

            profile = (await _employerRepository.GetByIdAsync(userId));

            try
            {
                var result = new TalentSnapshotViewModel
                {
                    CurrentEmployment = "Software Developer at XYZ",
                    Level             = "Junior",
                    Name    = "Suresh Murugesan",
                    PhotoId = "",
                    Skills  = new List <string> {
                        "C#", ".Net Core", "Javascript", "ReactJS", "PreactJS"
                    },
                    Summary = "Veronika Ossi is a set designer living in New York who enjoys kittens, music, and partying.",
                    Visa    = "Citizen"
                };
                return(Json(new { Success = true, data = result }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, e.Message }));
            }
        }
Ejemplo n.º 7
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            //Your code here;
            try
            {
                if (!forJob)
                {
                    var employerId = employerOrJobId;
                    var profile    = await _employerRepository.GetByIdAsync(employerId);

                    var users = _userRepository.Collection.Skip(position).Take(increment).AsEnumerable();
                    if (profile != null)
                    {
                        var result = new List <TalentSnapshotViewModel>();

                        foreach (var user in users)
                        {
                            var skills = new List <string>();
                            foreach (var skill in user.Skills)
                            {
                                skills.Add(skill.Skill);
                            }

                            var newSnapshot = new TalentSnapshotViewModel();
                            newSnapshot.Id       = user.Id;
                            newSnapshot.Name     = user.FirstName + " " + user.LastName;
                            newSnapshot.PhotoId  = user.ProfilePhotoUrl;
                            newSnapshot.VideoUrl = user.VideoName;
                            newSnapshot.CVUrl    = user.CvName;
                            newSnapshot.Summary  = user.Summary;
                            if (user.Experience.Count > 0)
                            {
                                newSnapshot.CurrentEmployment = user.Experience[0].Company;
                                newSnapshot.Level             = user.Experience[0].Position;
                            }
                            newSnapshot.Visa   = user.VisaStatus;
                            newSnapshot.Skills = skills;

                            result.Add(newSnapshot);
                        }
                        return(result);
                    }
                    return(null);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            Employer profile    = (await _employerRepository.GetByIdAsync(employerOrJobId));
            var      listTalent = _userRepository.Collection.Skip((position) * increment).Take(increment).AsEnumerable();

            if (profile != null)
            {
                var result = new List <TalentSnapshotViewModel>();
                foreach (var talent in listTalent)
                {
                    var currentEmployment = "Not Employed";
                    var currentPosition   = "Not Employed";
                    var visa = talent.VisaStatus;
                    if (visa == null)
                    {
                        visa = "Unknown";
                    }
                    var skills     = talent.Skills.Select(x => ViewModelFromSkill(x).Name).ToList();
                    var experience = talent.Experience.Select(x => ViewModelFromExperience(x)).ToList();

                    if (experience.Count != 0)
                    {
                        var currentExperience = experience.OrderByDescending(x => x.End).FirstOrDefault();
                        currentPosition   = currentExperience.Position;
                        currentEmployment = currentExperience.Company;
                    }

                    var snapshot = new TalentSnapshotViewModel
                    {
                        Id                = talent.Id,
                        Name              = talent.FirstName + ' ' + talent.LastName,
                        PhotoId           = talent.ProfilePhotoUrl,
                        VideoUrl          = talent.VideoName,
                        CVUrl             = talent.CvName,
                        Summary           = talent.Summary,
                        LinkedInUrl       = talent.LinkedAccounts.LinkedIn,
                        GithubUrl         = talent.LinkedAccounts.Github,
                        CurrentEmployment = currentEmployment,
                        Position          = currentPosition,
                        Visa              = visa,
                        Skills            = skills
                    };
                    result.Add(snapshot);
                }
                return(result);
            }
            return(null);

            //Your code here;
            throw new NotImplementedException();
        }
Ejemplo n.º 9
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                //var skills = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                List <User> talentList = _userRepository.Collection.Select(x => new User()
                {
                    Id              = x.Id,
                    FirstName       = x.FirstName,
                    ProfilePhotoUrl = x.ProfilePhotoUrl,
                    VisaStatus      = x.VisaStatus,
                    //Level = x.Level,
                    Skills  = x.Skills,
                    Summary = x.Summary
                }).Take(increment).Skip(position).ToList();
                var result = new List <TalentSnapshotViewModel>();
                if (profile != null)
                {
                    //var result = new List<TalentSnapshotViewModel>();

                    foreach (var item in talentList)
                    {
                        var newItem = new TalentSnapshotViewModel();

                        newItem.Id     = item.Id;
                        newItem.Name   = item.FirstName;
                        newItem.Visa   = item.VisaStatus;
                        newItem.Skills = new List <string>()
                        {
                            "item.Skills"
                        };
                        //newItem.Level = new List<string>() { item.Level };
                        newItem.PhotoId = item.ProfilePhotoUrl;
                        newItem.Summary = item.Summary;

                        result.Add(newItem);
                    }
                    return(result);
                }
                return(null);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                var talentFeedList = _userRepository.Collection.Skip(position).Take(increment).AsEnumerable();

                if (profile != null)
                {
                    var result = new List <TalentSnapshotViewModel>();



                    foreach (var item in talentFeedList)
                    {
                        var newItem = new TalentSnapshotViewModel();
                        newItem.Id       = item.Id;
                        newItem.Name     = item.LastName + ' ' + item.FirstName;
                        newItem.PhotoId  = item.ProfilePhotoUrl;
                        newItem.VideoUrl = String.IsNullOrEmpty(item.VideoName) ? null : (await _fileService.GetFileURL(item.VideoName, FileType.UserVideo));
                        newItem.CVUrl    = String.IsNullOrEmpty(item.CvName) ? null : (await _fileService.GetFileURL(item.CvName, FileType.UserVideo));
                        newItem.Summary  = item.Summary;
                        var recentExperience = item.Experience.OrderByDescending(x => x.End).FirstOrDefault();
                        newItem.CurrentEmployment = (recentExperience != null) ? (recentExperience.Company + ' ' + recentExperience.Position)
                            : "Not defined";
                        newItem.Visa  = item.VisaStatus;
                        newItem.Level = "Not defined";
                        if (item.Skills.Count != 0)
                        {
                            newItem.Skills = item.Skills.Select(x => x.Skill).ToList();
                        }
                        else
                        {
                            newItem.Skills = null;
                        }
                        result.Add(newItem);
                    }

                    return(result);
                }
                return(null);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Ejemplo n.º 11
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int activeFeed, int limit)
        {
            //Your code here;
            // throw new NotImplementedException();
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                var talentList = _userRepository.GetQueryable().Skip((activeFeed - 1) * limit).Take(limit).ToList();
                if (profile != null)
                {
                    var result = new List <TalentSnapshotViewModel>();

                    foreach (var item in talentList)
                    {
                        if (string.IsNullOrEmpty(item.FirstName))
                        {
                            continue;
                        }

                        var newItem = new TalentSnapshotViewModel();
                        newItem.Id       = item.Id;
                        newItem.Name     = item.FirstName;
                        newItem.PhotoId  = item.ProfilePhotoUrl;
                        newItem.VideoUrl = item.VideoName;
                        newItem.CVUrl    = item.CvName;
                        newItem.Summary  = item.Summary;
                        newItem.Visa     = item.VisaStatus;
                        newItem.Skills   = new List <string> {
                            "C#", "React"
                        };


                        result.Add(newItem);
                    }
                    return(result);
                }
                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 12
0
        //Module 2----------------------------------------------------------------------------------------------------------------------

        //Original
        //public async Task<List<User>> GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        //{

        //    throw new NotImplementedException();
        //}


        //After Edited----------------------------------------------------------------------------------------------------------------------
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerId, bool forJob, int position, int increment)
        {
            //_userRepository.Collection;
            if (employerId != null)
            {
                var list = _userRepository.Collection.Skip(increment * (position - 1)).Take(increment);

                var result = new List <TalentSnapshotViewModel>();

                foreach (var user in list)
                {
                    var newUser = new TalentSnapshotViewModel();


                    if (user.Experience.Count > 0)
                    {
                        newUser.CurrentEmployment = user.Experience.LastOrDefault().Company;
                        newUser.Level             = user.Experience.LastOrDefault().Position;
                        //newUser.CurrentEmployment = "Tesing";
                    }

                    //newUser.CurrentEmployment = user.Experience.Last().Company;
                    //newUser.Level = user.Experience.Select(x=> x.Position).LastOrDefault().ToString();

                    newUser.Name   = user.FirstName + " " + user.LastName;
                    newUser.Visa   = user.VisaStatus;
                    newUser.Skills = user.Skills.Select(x => x.Skill).ToList();

                    if (user.LinkedAccounts != null)
                    {
                        newUser.linkedIn = user.LinkedAccounts.LinkedIn;
                        newUser.github   = user.LinkedAccounts.Github;
                    }



                    result.Add(newUser);
                }

                return(result);
            }
            return(null);
            //throw new NotImplementedException();
        }
Ejemplo n.º 13
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            try
            {
                // var profile = new List<User>();
                //List<User> profile = _userRepository.GetQueryable().ToList();
                IEnumerable <User> profile = await _userRepository.GetAll();

                var results = new List <TalentSnapshotViewModel>();
                foreach (var talent in profile)
                {
                    var skills    = talent.Skills.Select(x => ViewModelFromSkill(x).Name).ToList();
                    var company   = talent.Experience.Select(x => AddExperience(x).Company).ToList();
                    var positions = talent.Experience.Select(x => AddExperience(x).Position).ToList();

                    var snapshot = new TalentSnapshotViewModel
                    {
                        Id = talent.Id,


                        Name = talent.FirstName + ' ' + talent.LastName,
                        CurrentEmployment = company,
                        Level             = positions,
                        Skills            = skills,
                        Visa = talent.VisaStatus,
                    };
                    results.Add(snapshot);
                }
                return(results);
            }

            //return results;


            catch (MongoException e)
            {
                Console.WriteLine(e.Message);
            }
            throw new NotImplementedException();
        }
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                List <User> userList = _userRepository.Collection.Select(x => new User()
                {
                    Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Experience = x.Experience, ProfilePhotoUrl = x.ProfilePhotoUrl, VisaStatus = x.VisaStatus, Skills = x.Skills, Summary = x.Summary, VideoName = x.VideoName
                }).Take(increment).Skip(position).ToList();
                var result = new List <TalentSnapshotViewModel>();

                if (profile != null)
                {
                    foreach (var item in userList)
                    {
                        var newItem = new TalentSnapshotViewModel()
                        {
                            Id   = item.Id,
                            Name = item.FirstName + item.LastName,
                            CurrentEmployment = item.Experience.Select(x => x.Company).SingleOrDefault(),
                            Level             = item.Experience.Select(x => x.Position).SingleOrDefault(),
                            PhotoId           = item.ProfilePhotoUrl,
                            Visa     = item.VisaStatus,
                            Summary  = item.Summary,
                            VideoUrl = item.VideoName,
                            Skills   = item.Skills.Select(x => x.Skill).ToList()
                        };
                        result.Add(newItem);
                    }
                    return(result);
                }
                return(null);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Ejemplo n.º 15
0
        [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "recruiter, employer")] // new
        public IActionResult GetTalentSnapshots()                                                                  // FeedIncrementModel feed
        {
            //async Task<IActionResult>
            // var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false,0, 5)).ToList();

            // Dummy talent to fill out the list once we run out of data
            //if (result!=null)
            //{
            var data = new TalentSnapshotViewModel
            {
                CurrentEmployment = "Software Developer at XYZ",
                Level             = "Junior",
                Name    = "Dummy User1...",
                PhotoId = "",
                Skills  = new List <string> {
                    "C#", ".Net Core", "Javascript", "ReactJS", "PreactJS"
                },
                Summary = "Veronika Ossi is a set designer living in New York who enjoys kittens, music, and partying.",
                Visa    = "Citizen"
            };

            return(Json(new { Success = true, Data = data }));
        }
Ejemplo n.º 16
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            //Your code here;
            try
            {
                var profile = await _employerRepository.GetByIdAsync(employerOrJobId);

                var talentList = _userRepository.Collection.AsQueryable().Skip(position).Take(increment).AsEnumerable();
                if (profile != null)
                {
                    var result = new List <TalentSnapshotViewModel>();

                    foreach (var item in talentList)
                    {
                        var newItem = new TalentSnapshotViewModel();
                        newItem.Id       = item.Id;
                        newItem.Name     = item.FirstName + " " + item.LastName;
                        newItem.Summary  = item.Summary;
                        newItem.PhotoId  = item.ProfilePhotoUrl;
                        newItem.Visa     = item.VisaStatus;
                        newItem.VideoUrl = item.VideoName;
                        result.Add(newItem);
                    }
                    return(result);
                }
                else
                {
                    throw new Exception("Something went wrong");
                }
            }
            catch (Exception e) {
                throw new Exception(e.Message);
            }

            //throw new NotImplementedException();
        }
Ejemplo n.º 17
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            if (position >= _userRepository.Collection.Count())
            {
                return(null);
            }
            var            talentList = _userRepository.Collection.Skip(position).Take(increment).AsEnumerable();
            var            result     = new List <TalentSnapshotViewModel>();
            var            videoUrl   = "";
            var            cvUrl      = "";
            UserExperience experience;
            TalentSnapshotCurrentEmploymentViewModel employmentViewModel = null;

            foreach (var item in talentList)
            {
                videoUrl = string.IsNullOrWhiteSpace(item.VideoName)
                    ? ""
                    : await _fileService.GetFileURL(item.VideoName, FileType.UserVideo);

                cvUrl = string.IsNullOrWhiteSpace(item.CvName)
                    ? ""
                    : await _fileService.GetFileURL(item.CvName, FileType.UserCV);

                experience = null;
                // Find the lastest job
                foreach (var exp in item.Experience)
                {
                    if (experience == null)
                    {
                        experience = exp;
                    }
                    else
                    {
                        if (experience.End < exp.End)
                        {
                            experience = exp;
                        }
                    }
                }
                if (experience != null)
                {
                    employmentViewModel = new TalentSnapshotCurrentEmploymentViewModel
                    {
                        Company  = experience.Company,
                        Position = experience.Position
                    };
                }

                var newItem = new TalentSnapshotViewModel
                {
                    Id                = item.Id,
                    Name              = item.FirstName + " " + item.LastName,
                    PhotoId           = item.ProfilePhotoUrl,
                    VideoUrl          = videoUrl,
                    CVUrl             = cvUrl,
                    Summary           = item.Summary,
                    CurrentEmployment = employmentViewModel,
                    Visa              = item.VisaStatus,
                    Level             = "",
                    Skills            = item.Skills.Select(x => x.Skill).ToList(),
                    LinkedAccounts    = item.LinkedAccounts
                };
                result.Add(newItem);
            }
            return(result);
        }
Ejemplo n.º 18
0
 public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(TalentSnapshotViewModel model)
 {
     //Your code here;
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            //Your code here;
            Employer employer = null;

            var watchList = new List <TalentSnapshotViewModel>();

            employer = (await _employerRepository.GetByIdAsync(employerOrJobId));
            User profile = null;

            profile = (await _userRepository.GetByIdAsync("6000bab71e0f780eb4d45f52"));

            if (employer != null)
            {
                //var talentWatchList = employer.TalentWatchlist;
                IEnumerable <User> talents = null;

                talents = (await _userRepository.Get(x => !x.IsDeleted));

                talents = talents.Skip(position).Take(increment);

                foreach (var talent in talents)
                {
                    //var catchAll = talent.CatchAll.GetElement("UserType").Value;

                    if (talent.CatchAll == null || talent.CatchAll.GetElement("UserType").Value != "Talent")
                    {
                        continue;
                    }
                    var videoUrl = "";
                    if (talent != null)
                    {
                        videoUrl = string.IsNullOrWhiteSpace(talent.VideoName)
                          ? ""
                          : await _fileService.GetFileURL(talent.VideoName, FileType.UserVideo);

                        var skills = talent.Skills.Select(x => ViewModelFromSkill(x).Name).ToList();

                        UserExperience latest = talent.Experience.OrderByDescending(x => x.End).FirstOrDefault();

                        string level, employment;
                        if (latest != null)
                        {
                            level      = latest.Position;
                            employment = latest.Company;
                        }
                        else
                        {
                            level      = "Unknown";
                            employment = "Unknown";
                        }
                        var talentProfileView = new TalentSnapshotViewModel
                        {
                            Id                = talent.Id,
                            Name              = talent.FirstName,
                            PhotoId           = talent.ProfilePhotoUrl,
                            Summary           = talent.Summary,
                            VideoUrl          = videoUrl,
                            CVUrl             = "",
                            CurrentEmployment = employment,
                            Visa              = talent.VisaStatus,
                            Level             = level,
                            Skills            = skills,
                        };
                        watchList.Add(talentProfileView);
                    }
                }
                return(watchList);
            }
            return(null);
        }
Ejemplo n.º 20
0
        public async Task <IEnumerable <TalentSnapshotViewModel> > GetTalentSnapshotList(string employerOrJobId, bool forJob, int position, int increment)
        {
            Employer profile    = null;
            var      employerID = employerOrJobId;

            if (forJob)
            {
                var job = await _jobRepository.GetByIdAsync(employerOrJobId);

                employerID = job.EmployerID;
            }

            profile = await _employerRepository.GetByIdAsync(employerID);

            var talentList = _userRepository.GetQueryable().Skip(position).Take(increment);

            if (profile != null)
            {
                var result = new List <TalentSnapshotViewModel>();

                foreach (var item in talentList)
                {
                    var photoId = "";
                    if (item.ProfilePhotoUrl != null)
                    {
                        photoId = item.ProfilePhotoUrl;
                    }

                    var videoUrl = "";
                    if (item.VideoName != null)
                    {
                        videoUrl = string.IsNullOrWhiteSpace(item.VideoName)
                                                                  ? ""
                                                                  : await _fileService.GetFileURL(item.VideoName, FileType.UserVideo);
                    }

                    var cvUrl = "";
                    if (item.CvName != null)
                    {
                        cvUrl = string.IsNullOrWhiteSpace(item.CvName)
                                                                  ? ""
                                                                  : await _fileService.GetFileURL(item.CvName, FileType.UserVideo);
                    }

                    var summary = "";
                    if (item.Summary != null)
                    {
                        summary = item.Summary;
                    }

                    // get current employment)
                    var currentEmployment = "";
                    if (item.Experience != null && item.Experience.Count > 0)
                    {
                        currentEmployment = item.Experience.First().Company;
                    }

                    var visa = "";
                    if (item.VisaStatus != null)
                    {
                        visa = item.VisaStatus;
                    }

                    // Hardcoded to Junior at the moment until source data
                    var level = "not available";

                    List <string> skills = new List <string>();
                    if (item.Skills != null)
                    {
                        Console.WriteLine("Skills not null.");
                        skills = item.Skills.Select(aSkill => aSkill.Skill).ToList();
                        Console.WriteLine($"Count: {item.Skills.Count}");
                    }

                    var talentSnapshot = new TalentSnapshotViewModel
                    {
                        Id                = item.Id,
                        Name              = item.FirstName + ' ' + item.LastName,
                        PhotoId           = photoId,
                        VideoUrl          = videoUrl,
                        CVUrl             = cvUrl,
                        CurrentEmployment = currentEmployment,
                        Level             = level,
                        Skills            = skills,
                        Summary           = summary,
                        Visa              = visa
                    };

                    result.Add(talentSnapshot);
                }

                return(result);
            }

            return(null);
        }