Ejemplo n.º 1
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;
            // throw new NotImplementedException();
            User profile = await _userRepository.GetByIdAsync(Id);

            var videoUrl = "";
            var photoUrl = "";

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

                photoUrl = string.IsNullOrWhiteSpace(profile.ProfilePhoto)
                         ? ""
                         : await _fileService.GetFileURL(profile.ProfilePhoto, FileType.ProfilePhoto);

                var skills     = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var languages  = profile.Languages.Select(x => ViewModelFromLanguages(x)).ToList();
                var experience = profile.Experience.Select(x => ViewModelfromExperience(x)).ToList();

                var result = new TalentProfileViewModel
                {
                    Id        = profile.Id,
                    FirstName = profile.FirstName,
                    LastName  = profile.LastName,
                    Gender    = profile.Gender,

                    Email                 = profile.Email,
                    Phone                 = profile.Phone,
                    MobilePhone           = profile.MobilePhone,
                    IsMobilePhoneVerified = profile.IsMobilePhoneVerified,

                    Address         = profile.Address,
                    Nationality     = profile.Nationality,
                    VisaStatus      = profile.VisaStatus,
                    VisaExpiryDate  = profile.VisaExpiryDate,
                    ProfilePhoto    = profile.ProfilePhoto,
                    ProfilePhotoUrl = photoUrl,

                    VideoName        = profile.VideoName,
                    VideoUrl         = videoUrl,
                    CvName           = profile.CvName,
                    Summary          = profile.Summary,
                    Description      = profile.Description,
                    LinkedAccounts   = profile.LinkedAccounts,
                    JobSeekingStatus = profile.JobSeekingStatus,



                    Skills     = skills,
                    Languages  = languages,
                    Experience = experience,
                };
                return(result);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            User profile = (await _userRepository.GetByIdAsync(Id));

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

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

                var languages      = profile.Languages.Select(x => ViewModeFromLanguage(x)).ToList();
                var skills         = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var education      = profile.Education.Select(x => ViewModelFromEducation(x)).ToList();
                var certifications = profile.Certifications.Select(x => ViewModelFromCertification(x)).ToList();
                var experience     = profile.Experience.Select(x => ViewModelFromExperience(x)).ToList();

                var result = new TalentProfileViewModel
                {
                    Id         = profile.Id,
                    FirstName  = profile.FirstName,
                    MiddleName = profile.MiddleName,
                    LastName   = profile.LastName,
                    Gender     = profile.Gender,

                    Email = profile.Email,

                    Phone                 = profile.Phone,
                    MobilePhone           = profile.MobilePhone,
                    IsMobilePhoneVerified = profile.IsMobilePhoneVerified,

                    Address         = profile.Address,
                    Nationality     = profile.Nationality,
                    VisaStatus      = profile.VisaStatus,
                    VisaExpiryDate  = profile.VisaExpiryDate,
                    ProfilePhoto    = profile.ProfilePhoto,
                    ProfilePhotoUrl = profile.ProfilePhotoUrl,

                    VideoName        = profile.VideoName,
                    VideoUrl         = videoUrl,
                    CvName           = profile.CvName,
                    CvUrl            = cvUrl,
                    Summary          = profile.Summary,
                    Description      = profile.Description,
                    LinkedAccounts   = profile.LinkedAccounts,
                    JobSeekingStatus = profile.JobSeekingStatus,

                    Languages      = languages,
                    Skills         = skills,
                    Education      = education,
                    Certifications = certifications,
                    Experience     = experience
                };
                return(result);
            }
            return(null);
        }
Ejemplo n.º 3
0
        protected string UpdateTalentExperiencesFromView(User user, TalentProfileViewModel model)
        {
            var newExperiences = new List <UserExperience>();

            foreach (var item in model.Experience)
            {
                var experience = user.Experience.SingleOrDefault(x => x.Id == item.Id);
                if (experience == null)
                {
                    experience = new UserExperience {
                        Id = ObjectId.GenerateNewId().ToString()
                    }
                }
                ;
                experience.UserId           = user.Id;
                experience.IsDeleted        = false;
                experience.Company          = item.Company;
                experience.Position         = item.Position;
                experience.Responsibilities = item.Responsibilities;
                experience.Start            = item.Start;
                experience.End = item.End;
                newExperiences.Add(experience);
            }
            user.Experience = newExperiences;
            return(null);
        }
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            User user = await _userRepository.GetByIdAsync(Id);

            //Mapping Language
            List <UserLanguage>         userLanguages      = user.Languages;
            List <AddLanguageViewModel> languagesViewModel = new List <AddLanguageViewModel>();

            foreach (var lang in userLanguages)
            {
                if (lang.IsDeleted == false)
                {
                    languagesViewModel.Add(new AddLanguageViewModel()
                    {
                        Name          = lang.Language,
                        Level         = lang.LanguageLevel,
                        Id            = lang.Id,
                        CurrentUserId = lang.UserId
                    });
                }
            }
            //Mapping Skill
            List <UserSkill>         userSkills      = user.Skills;
            List <AddSkillViewModel> skillsViewModel = new List <AddSkillViewModel>();

            foreach (var skill in userSkills)
            {
                if (skill.IsDeleted == false)
                {
                    skillsViewModel.Add(new AddSkillViewModel()
                    {
                        Name  = skill.Skill,
                        Level = skill.ExperienceLevel,
                        Id    = skill.Id,
                    });
                }
            }
            //Mapping Experience
            List <UserExperience>      userExperience      = user.Experience;
            List <ExperienceViewModel> experienceViewModel = new List <ExperienceViewModel>();

            foreach (var exp in userExperience)
            {
                if (exp.IsDeleted == false)
                {
                    experienceViewModel.Add(_mapper.Map <UserExperience, ExperienceViewModel>(exp));
                }
            }


            //Mapping Profile
            TalentProfileViewModel profileViewModel = _mapper.Map <User, TalentProfileViewModel>(user);

            profileViewModel.Languages  = languagesViewModel;
            profileViewModel.Skills     = skillsViewModel;
            profileViewModel.Experience = experienceViewModel;

            return(profileViewModel);
        }
Ejemplo n.º 5
0
        // public bool AddNewLanguage(AddLanguageViewModel language)
        // {

        //UserLanguage userLanguage = new UserLanguage
        // {
        //var userLanguage = new List<UserLanguage>();
        //// Id = language.Id,
        //UserId = language.CurrentUserId,
        // Language = language.Name,
        //LanguageLevel = language.Level

        // };

        //return true;
        //}

        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            User profile  = (await _userRepository.GetByIdAsync(Id));
            var  videoUrl = "";

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


                var skills     = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var language   = profile.Languages.Select(x => ViewModelFromLanguage(x)).ToList();
                var experience = profile.Experience.Select(x => ViewModelFromExperience(x)).ToList();

                var result = new TalentProfileViewModel
                {
                    Id             = profile.Id,
                    LinkedAccounts = new LinkedAccounts {
                        LinkedIn = profile.LinkedAccounts.LinkedIn, Github = profile.LinkedAccounts.Github
                    },
                    Description = profile.Description,
                    FirstName   = profile.FirstName,
                    MiddleName  = profile.MiddleName,
                    LastName    = profile.LastName,
                    Email       = profile.Email,
                    Summary     = profile.Summary,
                    Experience  = experience,
                    Languages   = language,
                    Phone       = profile.Phone,
                    Gender      = profile.Gender,
                    Address     = new Address
                    {
                        Number   = profile.Address.Number,
                        Street   = profile.Address.Street,
                        Suburb   = profile.Address.Suburb,
                        PostCode = profile.Address.PostCode,
                        City     = profile.Address.City,
                        Country  = profile.Address.Country
                    },
                    Nationality      = profile.Nationality,
                    VisaStatus       = profile.VisaStatus,
                    JobSeekingStatus = new JobSeekingStatus {
                        Status = profile.JobSeekingStatus.Status, AvailableDate = profile.JobSeekingStatus.AvailableDate
                    },
                    VisaExpiryDate  = profile.VisaExpiryDate,
                    Skills          = skills,
                    ProfilePhoto    = profile.ProfilePhoto,
                    ProfilePhotoUrl = profile.ProfilePhotoUrl,
                    VideoName       = profile.VideoName,
                    VideoUrl        = videoUrl,
                };
                return(result);
            }

            return(null);
        }
Ejemplo n.º 6
0
        //public async task<talentprofileviewmodel> gettalentprofile(string id)
        //{
        //    //your code here;
        //    throw new notimplementedexception();
        //}

        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //User profile = null;

            User profile = (await _userRepository.GetByIdAsync(Id));

            //await awsService.GetAllObjectFromS3("talent-standard-glenn");

            if (profile != null)
            {
                var languages = profile.Languages.Select(x => ViewModelFromLanguage(x)).ToList();
                var skills    = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();

                string currentUrl = "";

                //var a = profile.Skills.ToList();
                if (!string.IsNullOrWhiteSpace(profile.ProfilePhoto))
                {
                    currentUrl = await _fileService.GetFileURL(profile.ProfilePhoto, FileType.ProfilePhoto);
                }
                else
                {
                    currentUrl = "";
                }


                var result = new TalentProfileViewModel
                {
                    Id = profile.Id,

                    FirstName  = profile.FirstName,
                    MiddleName = profile.MiddleName,
                    LastName   = profile.LastName,

                    LinkedAccounts   = profile.LinkedAccounts,
                    Phone            = profile.Phone,
                    Email            = profile.Email,
                    Description      = profile.Description,
                    Summary          = profile.Summary,
                    Address          = profile.Address,
                    Nationality      = profile.Nationality,
                    Languages        = languages,
                    Skills           = skills,
                    VisaStatus       = profile.VisaStatus,
                    VisaExpiryDate   = profile.VisaExpiryDate,
                    JobSeekingStatus = profile.JobSeekingStatus,
                    ProfilePhoto     = profile.ProfilePhoto,

                    //ProfilePhotoUrl = profile.ProfilePhotoUrl,
                    ProfilePhotoUrl = currentUrl
                };
                return(result);
            }

            return(null);
        }
Ejemplo n.º 7
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //Your code here;
            try
            {
                if (model.Id != null)
                {
                    User Userfind = await _userRepository.GetByIdAsync(updaterId);

                    if (Userfind != null)
                    {
                        Userfind.Id                    = model.Id;
                        Userfind.FirstName             = model.FirstName;
                        Userfind.LastName              = model.LastName;
                        Userfind.MiddleName            = model.MiddleName;
                        Userfind.Gender                = model.Gender;
                        Userfind.Email                 = model.Email;
                        Userfind.Phone                 = model.Phone;
                        Userfind.MobilePhone           = model.MobilePhone;
                        Userfind.IsMobilePhoneVerified = model.IsMobilePhoneVerified;
                        Userfind.Address               = model.Address;
                        Userfind.Nationality           = model.Nationality;
                        Userfind.VisaStatus            = model.VisaStatus;
                        Userfind.VisaExpiryDate        = model.VisaExpiryDate;
                        Userfind.ProfilePhoto          = model.ProfilePhoto;
                        Userfind.ProfilePhotoUrl       = model.ProfilePhotoUrl;
                        Userfind.VideoName             = model.VideoName;
                        //Userfind.Videos= model.VideoUrl;
                        Userfind.CvName = model.CvName;
                        //Userfind.Cvurl = model.CvUrl;
                        Userfind.Summary          = model.Summary;
                        Userfind.Description      = model.Description;
                        Userfind.LinkedAccounts   = model.LinkedAccounts;
                        Userfind.JobSeekingStatus = model.JobSeekingStatus;
                        //Userfind.Languages = model.Languages;
                        //Userfind.Skills = model.Skills;



                        await _userRepository.Update(Userfind);
                    }
                }
                else
                {
                    throw new ApplicationException("User not Exist");
                }
            }
            catch (MongoException e)
            {
                return(false);
            }



            throw new NotImplementedException();
        }
Ejemplo n.º 8
0
        //protected AddSkillViewModel ViewModelFromSkill(UserSkill skill)
        //{
        //    return new AddSkillViewModel
        //    {

        //        Id = skill.Id,
        //        Level = skill.ExperienceLevel,
        //        Name = skill.Skill

        //    };
        //}



//        protected void UpdateSkillFromView(AddSkillViewModel model, UserSkill original)
//        {
//            original.ExperienceLevel = model.Level;
//            original.Skill = model.Name;
//        }



//        #region Build Views from Model

//        protected AddSkillViewModel ViewModelFromSkill(UserSkill skill)
//        {
//            return new AddSkillViewModel
//            {
//                Id = skill.Id,
//                Level = skill.ExperienceLevel,
//                Name = skill.Skill
//            };
//        }



        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel talent, string updaterId)
        {
            try
            {
                if (talent.Id != null)
                {
                    User currentTalent = (await _userRepository.GetByIdAsync(talent.Id));

                    //To be continued
                    currentTalent.FirstName = talent.FirstName;
                    currentTalent.LastName  = talent.LastName;

                    currentTalent.LinkedAccounts   = talent.LinkedAccounts;
                    currentTalent.Phone            = talent.Phone;
                    currentTalent.Email            = talent.Email;
                    currentTalent.Description      = talent.Description;
                    currentTalent.Summary          = talent.Summary;
                    currentTalent.Address          = talent.Address;
                    currentTalent.Nationality      = talent.Nationality;
                    currentTalent.VisaStatus       = talent.VisaStatus;
                    currentTalent.VisaExpiryDate   = talent.VisaExpiryDate;
                    currentTalent.JobSeekingStatus = talent.JobSeekingStatus;

                    var newLanguage = new List <UserLanguage>();

                    foreach (var item in talent.Languages)
                    {
                        var Currentlanguage = currentTalent.Languages.SingleOrDefault(x => x.Id == item.Id);

                        if (Currentlanguage == null)
                        {
                            Currentlanguage = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }

                        UpdateLanguageFromView(item, Currentlanguage);
                        newLanguage.Add(Currentlanguage);
                    }
                    currentTalent.Languages = newLanguage;


                    await _userRepository.Update(currentTalent);

                    return(true);
                }
                return(false);
            }

            catch (MongoException)
            {
                return(false);
            }
        }
Ejemplo n.º 9
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            User profile = null;

            profile = (await _userRepository.GetByIdAsync(Id));

            var videoUrl = "";

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

                var skills    = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var languages = profile.Languages.Select(x => new AddLanguageViewModel {
                    Id = x.Id, Name = x.Language, Level = x.LanguageLevel
                }).ToList();
                var experience = profile.Experience.Select(x => new ExperienceViewModel {
                    Id = x.Id, Company = x.Company, Position = x.Position, Responsibilities = x.Responsibilities, Start = x.Start, End = x.End
                }).ToList();

                var result = new TalentProfileViewModel
                {
                    Id                    = profile.Id,
                    FirstName             = profile.FirstName,
                    MiddleName            = profile.MiddleName,
                    LastName              = profile.LastName,
                    Gender                = profile.Gender,
                    Email                 = profile.Email,
                    Phone                 = profile.Phone,
                    MobilePhone           = profile.MobilePhone,
                    Address               = profile.Address,
                    LinkedAccounts        = profile.LinkedAccounts,
                    Nationality           = profile.Nationality,
                    VisaStatus            = profile.VisaStatus,
                    JobSeekingStatus      = profile.JobSeekingStatus,
                    VisaExpiryDate        = profile.VisaExpiryDate,
                    Summary               = profile.Summary,
                    Description           = profile.Description,
                    ProfilePhoto          = profile.ProfilePhoto,
                    ProfilePhotoUrl       = profile.ProfilePhotoUrl,
                    VideoName             = profile.VideoName,
                    Experience            = experience,
                    Skills                = skills,
                    Languages             = languages,
                    VideoUrl              = videoUrl,
                    IsMobilePhoneVerified = profile.IsMobilePhoneVerified,
                };
                return(result);
            }

            return(null);
        }
 public async Task <IActionResult> UpdateTalentProfile([FromBody] TalentProfileViewModel profile)
 {
     if (ModelState.IsValid)
     {
         if (await _profileService.UpdateTalentProfile(profile, _userAppContext.CurrentUserId))
         {
             return(Json(new { Success = true }));
         }
     }
     return(Json(new { Success = false }));
 }
 public async Task <IActionResult> UpdateTalentProfile([FromBody] TalentProfileViewModel profile)
 {
     if (ModelState.IsValid)
     {
         if (await _profileService.UpdateTalentProfile(profile, _userAppContext.CurrentUserId))
         {
             return(Json(new { Success = true }));
             //throw new System.ArithmeticException("Dhanuka Error...!!!");
         }
     }
     return(Json(new { Success = false }));
 }
Ejemplo n.º 12
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;
            //throw new NotImplementedException();

            User profile = null;

            profile = (await _userRepository.GetByIdAsync(Id));

            if (profile != null)
            {
                var languages  = profile.Languages.Select(x => ViewModelFromLanguage(x)).ToList();
                var skills     = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var experience = profile.Experience.Select(x => ViewModelFromExperience(x)).ToList();

                var result = new TalentProfileViewModel
                {
                    Id         = profile.Id,
                    FirstName  = profile.FirstName,
                    MiddleName = profile.MiddleName,
                    LastName   = profile.LastName,
                    Gender     = profile.Gender,

                    Email = profile.Email,

                    Phone                 = profile.Phone,
                    MobilePhone           = profile.MobilePhone,
                    IsMobilePhoneVerified = profile.IsMobilePhoneVerified,

                    //Address = profile.Address,
                    Address         = profile.Address,
                    Nationality     = profile.Nationality,
                    VisaStatus      = profile.VisaStatus,
                    VisaExpiryDate  = profile.VisaExpiryDate,
                    ProfilePhoto    = profile.ProfilePhoto,
                    ProfilePhotoUrl = profile.ProfilePhotoUrl,

                    Summary          = profile.Summary,
                    Description      = profile.Description,
                    LinkedAccounts   = profile.LinkedAccounts,
                    JobSeekingStatus = profile.JobSeekingStatus,

                    Languages  = languages,
                    Skills     = skills,
                    Experience = experience,
                };

                return(result);
            }

            return(null);
        }
Ejemplo n.º 13
0
 public async Task <IActionResult> UpdateTalentProfile([FromBody] TalentProfileViewModel profile)
 {
     Console.WriteLine("before model valiatino");
     Console.WriteLine(profile);
     if (ModelState.IsValid)
     {
         if (await _profileService.UpdateTalentProfile(profile, _userAppContext.CurrentUserId))
         {
             return(Json(new { Success = true }));
         }
     }
     Console.WriteLine("failed");
     return(Json(new { Success = false }));
 }
Ejemplo n.º 14
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //Your code here;

            try
            {
                if (model.Id != null)
                {
                    User existingTalent = (await _userRepository.GetByIdAsync(model.Id));
                    existingTalent.FirstName      = model.FirstName;
                    existingTalent.MiddleName     = model.MiddleName;
                    existingTalent.LastName       = model.LastName;
                    existingTalent.Email          = model.Email;
                    existingTalent.Phone          = model.Phone;
                    existingTalent.LinkedAccounts = model.LinkedAccounts;
                    existingTalent.Address        = model.Address;
                    existingTalent.Nationality    = model.Nationality;

                    var newLanguages = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var lang = existingTalent.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (lang == null)
                        {
                            lang = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLangFromView(item, lang);
                        newLanguages.Add(lang);
                    }
                    existingTalent.Languages = newLanguages;

                    existingTalent.UpdatedBy = updaterId;
                    existingTalent.UpdatedOn = DateTime.Now;
                    await _userRepository.Update(existingTalent);

                    return(true);
                }
                return(false);
            }

            catch (MongoException e)
            {
                return(false);
            }
        }
Ejemplo n.º 15
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //Your code here;
            // throw new NotImplementedException();

            try
            {
                if (model.Id != null)
                {
                    User existingEmployer = (await _userRepository.GetByIdAsync(model.Id));
                    existingEmployer.FirstName  = model.FirstName;
                    existingEmployer.MiddleName = model.MiddleName;
                    existingEmployer.LastName   = model.LastName;
                    existingEmployer.Gender     = model.Gender;
                    existingEmployer.Email      = model.Email;

                    existingEmployer.Phone = model.Phone;
                    //existingEmployer.MobilePhone = model.MobilePhone;
                    existingEmployer.Address        = model.Address;
                    existingEmployer.Nationality    = model.Nationality;
                    existingEmployer.LinkedAccounts = model.LinkedAccounts;
                    existingEmployer.VisaStatus     = model.VisaStatus;
                    existingEmployer.VisaExpiryDate = model.VisaExpiryDate;

                    existingEmployer.JobSeekingStatus = model.JobSeekingStatus;

                    existingEmployer.Summary     = model.Summary;
                    existingEmployer.Description = model.Description;

                    existingEmployer.ProfilePhoto    = model.ProfilePhoto;
                    existingEmployer.ProfilePhotoUrl = model.ProfilePhotoUrl;



                    existingEmployer.UpdatedBy = updaterId;

                    await _userRepository.Update(existingEmployer);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Ejemplo n.º 16
0
        //GET TALENT PROFILE
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;
            //swati
            User profile = null;

            profile = (await _userRepository.GetByIdAsync(Id));


            if (profile != null)
            {
                var skills       = profile.Skills.Select(x => ViewModelFromSkill(x)).ToList();
                var languages    = profile.Languages.Select(x => ViewModelFromLanguage(x)).ToList();
                var certificates = profile.Certifications.Select(x => ViewModelFromCertificate(x)).ToList();
                var experience   = profile.Experience.Select(x => ViewModelFromExperience(x)).ToList();

                var result = new TalentProfileViewModel
                {
                    Id               = profile.Id,
                    FirstName        = profile.FirstName,
                    MiddleName       = profile.MiddleName,
                    Address          = profile.Address,
                    Nationality      = profile.Nationality,
                    Email            = profile.Email,
                    Phone            = profile.Phone,
                    Description      = profile.Description,
                    Languages        = languages,
                    Skills           = skills,
                    Certifications   = certificates,
                    LinkedAccounts   = profile.LinkedAccounts,
                    ProfilePhoto     = profile.ProfilePhoto,
                    ProfilePhotoUrl  = profile.ProfilePhotoUrl,
                    JobSeekingStatus = profile.JobSeekingStatus,
                    Summary          = profile.Summary,
                    VisaExpiryDate   = profile.VisaExpiryDate,
                    VisaStatus       = profile.VisaStatus,
                    //Education = profile.Education,
                    Experience = experience
                };
                return(result);
            }

            return(null);
        }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            User user         = _mapper.Map <TalentProfileViewModel, User>(model);
            User existingUser = await _userRepository.GetByIdAsync(updaterId);

            user.Id        = updaterId;
            user.UId       = existingUser.UId;
            user.CreatedOn = existingUser.CreatedOn;
            user.CreatedBy = existingUser.CreatedBy;
            user.UpdatedOn = DateTime.Now;
            user.UpdatedBy = updaterId;
            user.IsDeleted = existingUser.IsDeleted;
            user.Login     = existingUser.Login;


            await _userRepository.Update(user);

            return(true);
        }
Ejemplo n.º 18
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;
            var user = await _userRepository.GetByIdAsync(Id);

            var videoUrl = string.IsNullOrWhiteSpace(user.VideoName)
                           ? ""
                           : await _fileService.GetFileURL(user.VideoName, FileType.UserVideo);

            var skills      = user.Skills.Select(x => ViewModelFromSkill(x)).ToList();
            var languages   = user.Languages.Select(x => ViewModelFromLanguages(x)).ToList();
            var experiences = user.Experience.Select(x => ViewModelFromExperiences(x)).ToList();

            var result = new TalentProfileViewModel
            {
                Id                    = user.Id,
                FirstName             = user.FirstName,
                MiddleName            = user.MiddleName,
                LastName              = user.LastName,
                Gender                = user.Gender,
                Email                 = user.Email,
                Phone                 = user.Phone,
                MobilePhone           = user.MobilePhone,
                IsMobilePhoneVerified = user.IsMobilePhoneVerified,
                JobSeekingStatus      = user.JobSeekingStatus,
                Skills                = skills,
                Languages             = languages,
                Experience            = experiences,
                Summary               = user.Summary,
                Description           = user.Description,
                LinkedAccounts        = user.LinkedAccounts,
                Nationality           = user.Nationality,
                Address               = user.Address,
                VisaStatus            = user.VisaStatus,
                VisaExpiryDate        = user.VisaExpiryDate,
                ProfilePhoto          = user.ProfilePhoto,
                ProfilePhotoUrl       = user.ProfilePhotoUrl,
                VideoName             = user.VideoName,
                VideoUrl              = videoUrl
            };

            return(result);
        }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel newUserModel, string updaterId)
        {
            if (newUserModel.Id != null)
            {
                User user = await _userRepository.GetByIdAsync(newUserModel.Id);

                if (user != null)
                {
                    user.Id                    = newUserModel.Id;
                    user.FirstName             = newUserModel.FirstName;
                    user.MiddleName            = newUserModel.MiddleName;
                    user.LastName              = newUserModel.LastName;
                    user.Gender                = newUserModel.Gender;
                    user.Email                 = newUserModel.Email;
                    user.Phone                 = newUserModel.Phone;
                    user.MobilePhone           = newUserModel.MobilePhone;
                    user.IsMobilePhoneVerified = newUserModel.IsMobilePhoneVerified;
                    user.Address               = newUserModel.Address;
                    user.Nationality           = newUserModel.Nationality;
                    user.VisaStatus            = newUserModel.VisaStatus;
                    user.VisaExpiryDate        = newUserModel.VisaExpiryDate;
                    user.VideoName             = newUserModel.VideoName;
                    user.ProfilePhoto          = newUserModel.ProfilePhoto;
                    user.ProfilePhotoUrl       = newUserModel.ProfilePhotoUrl;
                    user.CvName                = newUserModel.CvName;
                    user.Summary               = newUserModel.Summary;
                    user.Description           = newUserModel.Description;
                    user.LinkedAccounts        = newUserModel.LinkedAccounts;
                    user.JobSeekingStatus      = newUserModel.JobSeekingStatus;
                    user.UpdatedOn             = DateTime.Now;
                    user.UpdatedBy             = updaterId;
                    user.Skills                = UpdateSkillList(user, newUserModel.Skills);

                    user.Languages  = UpdateLanguageList(user, newUserModel.Languages);
                    user.Experience = UpdateExperienceList(user, newUserModel.Experience);
                    await _userRepository.Update(user);

                    return(true);
                }
                return(false);
            }
            return(false);
        }
Ejemplo n.º 20
0
        protected string UpdateTalentSkillsFromView(User user, TalentProfileViewModel model)
        {
            var newSkills = new List <UserSkill>();
            IDictionary <string, bool> skillNames = new Dictionary <string, bool>();

            foreach (var item in model.Skills)
            {
                if (String.IsNullOrWhiteSpace(item.Name))
                {
                    return("Please enter skill name.");
                }
                if (String.IsNullOrWhiteSpace(item.Level))
                {
                    return("Please select skill level.");
                }
                if (skillNames.ContainsKey(item.Name))
                {
                    return("Can't save a skill which you already have.");
                }

                var skill = user.Skills.SingleOrDefault(x => x.Id == item.Id);
                if (skill == null)
                {
                    skill = new UserSkill {
                        Id = ObjectId.GenerateNewId().ToString()
                    }
                }
                ;
                skill.UserId          = user.Id;
                skill.IsDeleted       = false;
                skill.ExperienceLevel = item.Level;
                skill.Skill           = item.Name;
                newSkills.Add(skill);

                skillNames.Add(skill.Skill, true);
            }

            user.Skills = newSkills;
            return(null);
        }
Ejemplo n.º 21
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;

            User user = null;

            user = await _userRepository.GetByIdAsync(Id);

            var languages  = user.Languages.Select(x => ViewModelFromLanguage(x)).ToList();
            var skills     = user.Skills.Select(x => ViewModelFromSkill(x)).ToList();
            var experience = user.Experience.Select(x => ViewModelFromExperience(x)).ToList();

            if (user != null)
            {
                var result = new TalentProfileViewModel
                {
                    Id               = user.Id,
                    FirstName        = user.FirstName,
                    LastName         = user.LastName,
                    Email            = user.Email,
                    Phone            = user.Phone,
                    Address          = user.Address,
                    LinkedAccounts   = user.LinkedAccounts,
                    Description      = user.Description,
                    Summary          = user.Summary,
                    Nationality      = user.Nationality,
                    Languages        = languages,
                    Skills           = skills,
                    Experience       = experience,
                    VisaStatus       = user.VisaStatus,
                    VisaExpiryDate   = user.VisaExpiryDate,
                    JobSeekingStatus = user.JobSeekingStatus,
                    ProfilePhoto     = user.ProfilePhoto,
                    ProfilePhotoUrl  = user.ProfilePhotoUrl
                };
                return(result);
            }
            return(null);
            //throw new NotImplementedException();
        }
Ejemplo n.º 22
0
        public async Task <IActionResult> UpdateTalentProfile([FromBody] TalentProfileViewModel profile)
        {
            string goodNews = "Update successed";

            try
            {
                if (ModelState.IsValid)
                {
                    if (await _profileService.UpdateTalentProfile(profile, _userAppContext.CurrentUserId))
                    {
                        return(Json(new { Success = true, data = goodNews }));
                        //return Json(new { Success = true, data = profile });
                    }
                    return(Json(new { Success = false }));
                }
                return(Json(new { Success = false }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, message = e.Message }));
            }
        }
Ejemplo n.º 23
0
        protected string UpdateTalentLanguagesFromView(User user, TalentProfileViewModel model)
        {
            var newLanguages = new List <UserLanguage>();
            IDictionary <string, bool> languageNames = new Dictionary <string, bool>();

            foreach (var item in model.Languages)
            {
                if (String.IsNullOrWhiteSpace(item.Name))
                {
                    return("Please enter language name.");
                }
                if (String.IsNullOrWhiteSpace(item.Level))
                {
                    return("Please select language level.");
                }
                if (languageNames.ContainsKey(item.Name))
                {
                    return("Can't save a language which you already have.");
                }

                var language = user.Languages.SingleOrDefault(x => x.Id == item.Id);
                if (language == null)
                {
                    language = new UserLanguage {
                        Id = ObjectId.GenerateNewId().ToString()
                    }
                }
                ;
                language.UserId        = user.Id;
                language.IsDeleted     = false;
                language.Language      = item.Name;
                language.LanguageLevel = item.Level;
                newLanguages.Add(language);

                languageNames.Add(language.Language, true);
            }
            user.Languages = newLanguages;
            return(null);
        }
Ejemplo n.º 24
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    User existingUser = (await _userRepository.GetByIdAsync(model.Id));

                    existingUser.FirstName        = model.FirstName;
                    existingUser.MiddleName       = model.MiddleName;
                    existingUser.LastName         = model.LastName;
                    existingUser.Gender           = model.Gender;
                    existingUser.Email            = model.Email;
                    existingUser.Phone            = model.Phone;
                    existingUser.Address          = model.Address;
                    existingUser.Nationality      = model.Nationality;
                    existingUser.VisaStatus       = model.VisaStatus;
                    existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                    existingUser.JobSeekingStatus = model.JobSeekingStatus;
                    existingUser.Summary          = model.Summary;
                    existingUser.Description      = model.Description;
                    existingUser.LinkedAccounts   = model.LinkedAccounts;
                    existingUser.UpdatedBy        = updaterId;
                    existingUser.UpdatedOn        = DateTime.Now;



                    await _userRepository.Update(existingUser);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Ejemplo n.º 25
0
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;

            User profile = null;

            profile = (await _userRepository.GetByIdAsync(Id));

            try

            {
                if (profile != null)
                {
                    var languages = profile.Languages.Select(x => ViewModelFromLanguage(x)).ToList();

                    var result = new TalentProfileViewModel
                    {
                        Id             = profile.Id,
                        FirstName      = profile.FirstName,
                        MiddleName     = profile.MiddleName,
                        LastName       = profile.LastName,
                        Email          = profile.Email,
                        Phone          = profile.Phone,
                        LinkedAccounts = profile.LinkedAccounts,
                        Address        = profile.Address,
                        Nationality    = profile.Nationality,
                    };
                    return(result);
                }
                return(null);
            }

            catch (MongoException e)
            {
                return(null);
            }
        }
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            var user = await _userRepository.GetByIdAsync(Id);

            var videoUrl = string.IsNullOrWhiteSpace(user.VideoName)
                           ? ""
                           : await _fileService.GetFileURL(user.VideoName, FileType.UserVideo);

            var result = new TalentProfileViewModel
            {
                Id                    = user.Id,
                FirstName             = user.FirstName,
                MiddleName            = user.MiddleName,
                LastName              = user.LastName,
                Gender                = user.Gender,
                Email                 = user.Email,
                Phone                 = user.Phone,
                MobilePhone           = user.MobilePhone,
                IsMobilePhoneVerified = user.IsMobilePhoneVerified,
                Summary               = user.Summary,
                Description           = user.Description,
                Nationality           = user.Nationality,
                Address               = user.Address,
                VisaStatus            = user.VisaStatus,
                VisaExpiryDate        = user.VisaExpiryDate,
                ProfilePhoto          = user.ProfilePhoto,
                ProfilePhotoUrl       = user.ProfilePhotoUrl,
                VideoName             = user.VideoName,
                VideoUrl              = videoUrl,
                Certifications        = user.Certifications,
                Experience            = user.Experience,
                Education             = user.Education,
                Skills                = user.Skills
            };

            return(result);
        }
Ejemplo n.º 27
0
        public async Task <IActionResult> UpdateTalentProfile([FromBody] TalentProfileViewModel profile)
        {
            string message;
            bool   success;
            TalentProfileViewModel userProfile = null;

            if (ModelState.IsValid)
            {
                message = await _profileService.UpdateTalentProfile(profile, _userAppContext.CurrentUserId);

                success = String.IsNullOrEmpty(message);
                if (success)
                {
                    message     = "Update talent profile successful";
                    userProfile = await _profileService.GetTalentProfile(profile.Id);
                }
            }
            else
            {
                success = false;
                message = "Some model state values is invalid.";
            }
            return(Json(new { Success = success, Message = message, Data = userProfile }));
        }
        public async Task <TalentProfileViewModel> GetTalentProfile(string Id)
        {
            //Your code here;

            User profile = null;

            profile = (await _userRepository.GetByIdAsync(Id));

            var videoUrl = "";


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

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


                var result = new TalentProfileViewModel
                {
                    Id             = profile.Id,
                    FirstName      = profile.FirstName,
                    MiddleName     = profile.MiddleName,
                    LastName       = profile.LastName,
                    Email          = profile.Email,
                    Phone          = profile.Phone,
                    LinkedAccounts = profile.LinkedAccounts,
                    Address        = profile.Address,
                    Skills         = skills,
                };
                return(result);
            }
            return(null);
        }
Ejemplo n.º 29
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //my code starts here;

            try
            {
                if (model.Id != null)
                {
                    User existingUser = (await _userRepository.GetByIdAsync(model.Id));
                    existingUser.FirstName  = model.FirstName;
                    existingUser.MiddleName = model.MiddleName;
                    existingUser.LastName   = model.LastName;
                    existingUser.Gender     = model.Gender;
                    existingUser.Email      = model.Email;
                    existingUser.Phone      = model.Phone;
                    //existingUser.MobilePhone = model.MobilePhone;
                    //existingUser.IsMobilePhoneVerified = model.IsMobilePhoneVerified;
                    existingUser.Address          = model.Address;
                    existingUser.Nationality      = model.Nationality;
                    existingUser.VisaStatus       = model.VisaStatus;
                    existingUser.JobSeekingStatus = model.JobSeekingStatus;
                    existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                    existingUser.Summary          = model.Summary;
                    existingUser.Description      = model.Description;
                    //existinguser.VideoName = model.VideoName;
                    existingUser.ProfilePhoto    = model.ProfilePhoto;
                    existingUser.ProfilePhotoUrl = model.ProfilePhotoUrl;
                    //existinguser.CvName = model.CvName;
                    existingUser.LinkedAccounts = model.LinkedAccounts;
                    // skills
                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        if (string.IsNullOrEmpty(item.Id) || (item.Id).StartsWith("id"))
                        {
                            item.Id = ObjectId.GenerateNewId().ToString();
                        }
                        newSkills.Add(new UserSkill
                        {
                            Id              = item.Id,
                            IsDeleted       = false,
                            Skill           = item.Name,
                            ExperienceLevel = item.Level,
                            UserId          = model.Id
                        }
                                      );
                    }
                    existingUser.Skills = newSkills;
                    // Language
                    var newLanguages = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        //create new id if its just been added
                        if (string.IsNullOrEmpty(item.Id) || (item.Id).StartsWith("id"))
                        {
                            item.Id = ObjectId.GenerateNewId().ToString();
                        }
                        newLanguages.Add(new UserLanguage
                        {
                            Id            = item.Id,
                            Language      = item.Name,
                            LanguageLevel = item.Level,
                            IsDeleted     = false,
                            UserId        = model.Id
                        });
                    }
                    existingUser.Languages = newLanguages;
                    var newExperience = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        if (string.IsNullOrEmpty(item.Id) || (item.Id).StartsWith("id"))
                        {
                            item.Id = ObjectId.GenerateNewId().ToString();
                        }
                        newExperience.Add(new UserExperience
                        {
                            Id               = item.Id,
                            Company          = item.Company,
                            Position         = item.Position,
                            Responsibilities = item.Responsibilities,
                            Start            = item.Start,
                            End              = item.End
                        });
                    }
                    existingUser.Experience = newExperience;
                    // eduction

                    /* var newEducation = new List<UserEducation>();
                     * foreach (var item in model.Education)
                     * {
                     * newEducation.Add( new UserEducation
                     *       {
                     *           Id = item.Id,
                     *           IsDeleted = false
                     *       });
                     * }
                     * existinguser.Education = newEducation;
                     * var newCertifications = new List<UserCertification>();
                     * foreach (var item in model.Certifications)
                     * {
                     *   var Certifications = existinguser.Certifications.SingleOrDefault(x => x.Id == item.Id);
                     *   if (Certifications == null)
                     *   {
                     *       Certifications = new UserCertification
                     *       {
                     *           Id = ObjectId.GenerateNewId().ToString(),
                     *           IsDeleted = false
                     *       };
                     *   }
                     *   UpdateCertificationFromView(item, Certifications);
                     *   newCertifications.Add(Certifications);
                     * }
                     * existinguser.Certifications = newCertifications;
                     */
                    await _userRepository.Update(existingUser);
                }
                return(true);
            }
            catch (MongoException e)
            {
                return(false);
            }
            //my code ends here
            //throw new NotImplementedException();
        }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //Your code here;
            // TODO: Update method
            try
            {
                User existingUser = await _userRepository.GetByIdAsync(updaterId);

                existingUser.FirstName      = model.FirstName;
                existingUser.LastName       = model.LastName;
                existingUser.Email          = model.Email;
                existingUser.Phone          = model.Phone;
                existingUser.Address        = model.Address;
                existingUser.Nationality    = model.Nationality;
                existingUser.Summary        = model.Summary;
                existingUser.Description    = model.Description;
                existingUser.LinkedAccounts = model.LinkedAccounts;
                existingUser.CvName         = model.CvName;
                existingUser.CvName         = model.CvUrl;

                List <UserLanguage> userLanguagesList = new List <UserLanguage>();
                if (model.Languages != null)
                {
                    model.Languages.ForEach(language =>
                    {
                        UserLanguage userLanguage = LanguageFromViewModel(language);
                        userLanguagesList.Add(userLanguage);
                    });

                    existingUser.Languages = userLanguagesList;
                }


                List <UserSkill> userSkillsList = new List <UserSkill>();
                if (model.Skills != null)
                {
                    model.Skills.ForEach(skill =>
                    {
                        UserSkill userSkill = SkillFromViewModel(skill);
                        userSkillsList.Add(userSkill);
                    });

                    existingUser.Skills = userSkillsList;
                }


                List <UserExperience> userExperiencesList = new List <UserExperience>();
                if (model.Experience != null)
                {
                    model.Experience.ForEach(experience =>
                    {
                        UserExperience userExperience = ExperienceFromViewModel(experience);
                        userExperiencesList.Add(userExperience);
                    });

                    existingUser.Experience = userExperiencesList;
                }

                existingUser.VisaStatus       = model.VisaStatus;
                existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                existingUser.JobSeekingStatus = model.JobSeekingStatus;

                existingUser.ProfilePhoto    = model.ProfilePhoto;
                existingUser.ProfilePhotoUrl = model.ProfilePhotoUrl;

                // Update
                await _userRepository.Update(existingUser);

                return(true);
            }
            catch (Exception e)
            {
                return(false);

                throw e;
            }
            //throw new NotImplementedException();
        }