示例#1
0
 public async Task <IActionResult> GetTalentSnapshots([FromQuery] FeedIncrementModel feed)
 {
     try
     {
         var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number)).ToList();
         //Dummy talent to fill out the list once we run out of data
         _logger.LogInformation("result count is " + result.Count);
         if (result.Count == 0)
         {
             result.Add(
                 new TalentSnapshotViewModel
             {
                 CurrentEmployer = "XYZ",
                 Position        = "Software Developer",
                 Name            = "Dummy User...",
                 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, Feed = feed }));
     }
     catch (Exception e)
     {
         return(Json(new { Success = false, e.StackTrace, e.Message }));
     }
 }
        public async Task <IActionResult> GetTalentSnapshots([FromBody] FeedIncrementModel feed)
        {
            try
            {
                var res = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number)).ToList();

                //dummy talent to fill out the list once we run out of data
                //if (result.count == 0)
                //{
                //    var result =new List<TalentSnapshotViewModel>();
                //    result.Add(
                //            new Models.TalentSnapshotViewModel
                //            {
                //                CurrentEmployment = "Software Developer at XYZ",
                //                Level = "Junior",
                //                Name = "Dummy User...",
                //                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 = res }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, e.Message }));
            }
        }
        public async Task <IActionResult> GetTalentSnapshots(FeedIncrementModel feed)
        {
            try
            {
                // Already done but the data isn't feasable
                var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number)).ToList();
                // var result = new List<TalentSnapshotViewModel>() { };

                // Dummy talent to fill out the list once we run out of data
                if (result.Count == 0)
                {
                    result.Add(
                        new Models.TalentSnapshotViewModel
                    {
                        CurrentEmployment = new UserExperience()
                        {
                            Company = "Apple", Position = "Programmer", Start = new DateTime().ToUniversalTime()
                        },
                        Level   = "Junior",
                        Name    = "Dummy User...",
                        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",
                        LinkedAccounts = new LinkedAccounts()
                        {
                            Github = "https://github.com/AizenSousuke", LinkedIn = "https://linkedin.com"
                        }
                    }
                        );
                }

                // For debugging \ showcase
                //result.Add(
                //    new Models.TalentSnapshotViewModel
                //    {
                //        CurrentEmployment = "Software Developer at XYZ",
                //        Level = "Junior",
                //        Name = "A Dummy User...",
                //        PhotoId = "http://talent-photo2.s3.amazonaws.com/profile_5d667a6823826242f438201e_icon.png",
                //        Skills = new List<string> { "C#", ".Net Core", "Javascript", "ReactJS", "PreactJS" },
                //        Summary = "Dummy User is a set designer living in New York who enjoys kittens, music, and partying.",
                //        Visa = "Citizen",
                //        VideoUrl = "https://www.youtube.com/watch?v=iOHdxnEnOyo",
                //        CVUrl = "https://linkedin.com",
                //    }
                //);

                return(Json(new { Success = true, Data = result }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, e.Message }));
            }
        }
示例#4
0
 public async Task <IActionResult> GetTalentSnapshots(FeedIncrementModel feed)
 {
     try
     {
         var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number)).ToList();
         return(Json(new { Success = true, Data = result }));
     }
     catch (Exception e)
     {
         return(Json(new { Success = false, e.Message }));
     }
 }
 public async Task <IActionResult> GetTalentVideoList(FeedIncrementModel increment)
 {
     try
     {
         string employerId = _userAppContext.CurrentUserId;
         return(Json(new { Success = true, Data = await _profileService.GetTalentVideoFeed(employerId, increment) }));
     }
     catch (Exception e)
     {
         return(Json(new { Success = false, e.Message }));
     }
 }
示例#6
0
        public async Task <IActionResult> GetTalentSnapshots(FeedIncrementModel feed)
        {
            try
            {
                //Original
                var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number));

                //var result = (await _profileService.GetTalentTesting(_userAppContext.CurrentUserId, false, feed.Position, feed.Number));


                //After edited
                //var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number));

                // Dummy talent to fill out the list once we run out of data
                //if (result.Count == 0)
                //{
                //    result.Add(
                //            new Models.TalentSnapshotViewModel
                //            {
                //                CurrentEmployment = "Software Developer at XYZ",
                //                Level = "Junior",
                //                Name = "Dummy User...",
                //                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"
                //            }
                //        );
                //}
                int length = result.Count();

                //List<>

                //if (length >= 0)
                //{

                //}


                if (result != null)
                {
                    return(Json(new { Success = true, data = result, TheLength = length }));
                }
                return(Json(new { Success = false, data = "Nothing returned" }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, Message = e.Message }));
            }
        }
示例#7
0
        public async Task <IActionResult> GetTalentSnapshots(FeedIncrementModel feed)
        {
            try
            {
                var result = (await _profileService.GetTalentSnapshotList(_userAppContext.CurrentUserId, false, feed.Position, feed.Number)).ToList();

                // Dummy talent to fill out the list once we run out of data
                //if (result.Count == 0)
                //{

                /*  var result = new List<TalentSnapshotViewModel>();
                 *   result.Add(
                 *           new Models.TalentSnapshotViewModel
                 *            {
                 *                CurrentEmployment = "Software Developer at XYZ",
                 *                Level = "Junior",
                 *                Name = "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"
                 *            }
                 *        );
                 * result.Add(
                 *         new Models.TalentSnapshotViewModel
                 *         {
                 *             CurrentEmployment = "Software Developer at XYZ",
                 *             Level = "Junior",
                 *             Name = "User2",
                 *             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"
                 *         }
                 *      ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User3",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User4",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "ds",
                 *              Name = "User5",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User6",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User7",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User8",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User9",
                 *              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"
                 *          }
                 *       ); result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User10",
                 *              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"
                 *          }
                 *       );
                 *        result.Add(
                 *          new Models.TalentSnapshotViewModel
                 *          {
                 *              CurrentEmployment = "Software Developer at XYZ",
                 *              Level = "Junior",
                 *              Name = "User11",
                 *              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 }));
            }
        }
        public async Task <IEnumerable <TalentVideoMobileViewModel> > GetTalentVideoFeed(string employerId, FeedIncrementModel increment)
        {
            IEnumerable <User> suggestions = await GetSuggestedTalent(employerId);

            var userChunk = suggestions.Skip(increment.Position).Take(increment.Number);

            // Generating the models is I/O-bound on getting the video URLs from AWS
            // Running them in parallel should improve performance
            var tasks = userChunk.Select(x => BuildTalentVideoModel(x));
            await Task.WhenAll(tasks);

            return(tasks.Select(x => x.Result));
        }
        public async Task <IEnumerable <TalentSnapshotMobileViewModel> > GetTalentSnapshotList(string employerId, FeedIncrementModel increment)
        {
            IEnumerable <User> users = (await _userRepository.Get(x => !x.IsDeleted)).Skip(increment.Position).Take(increment.Number);

            List <TalentSnapshotMobileViewModel> result = new List <TalentSnapshotMobileViewModel>();

            foreach (var user in users)
            {
                result.Add(BuildTalentSnapshot(user));
            }
            return(result);
        }