/*public List<SavedFreelancersVM> AllSkills()
         * {
         *  List<SavedFreelancersVM> allSkills = new List<SavedFreelancersVM>();
         *
         *  var list = (from s in pg.skill
         *                              select new
         *                              {
         *                                  s.name
         *                              }).ToList();
         *  foreach (var item in list)
         *  {
         *      SavedFreelancersVM objcvm = new SavedFreelancersVM();
         *      objcvm.Skillname = item.name;
         *      allSkills.Add(objcvm);
         *  }
         *  return allSkills;
         * }
         *
         * public List<SavedFreelancersVM> AllExpertises()
         * {
         *  List<SavedFreelancersVM> allExpertises = new List<SavedFreelancersVM>();
         *
         *  var list = (from e in pg.expertise
         *                              select new
         *                              {
         *                                  e.name
         *                              }).ToList();
         *  foreach (var item in list)
         *  {
         *      SavedFreelancersVM objcvm = new SavedFreelancersVM();
         *      objcvm.Expertisename = item.name;
         *      allExpertises.Add(objcvm);
         *  }
         *  return allExpertises;
         * }
         *
         * public List<SavedFreelancersVM> AllRanks()
         * {
         *  List<SavedFreelancersVM> allRanks = new List<SavedFreelancersVM>();
         *
         *  var list = (from r in pg.rank_expertise
         *              select new
         *              {
         *                  r.rank_expertise_Id
         *              }).ToList();
         *  foreach (var item in list)
         *  {
         *      SavedFreelancersVM objcvm = new SavedFreelancersVM();
         *      objcvm.ExpertiseRank = item.rank_expertise_Id;
         *      allRanks.Add(objcvm);
         *  }
         *  return allRanks;
         * }*/

        public List <Freelancer> SavedFreeID(int cusID)
        {
            ProjektGruppFEntities1 pgfe           = new ProjektGruppFEntities1();
            List <Freelancer>      CusSavedFreeID = new List <Freelancer>();
            var IdList = (from c_f in pgfe.customer_freelancer
                          where c_f.customer_id == cusID
                          select new
            {
                c_f.freelancer_id
            }).ToList();

            foreach (var item in IdList)
            {
                Freelancer f = new Freelancer();
                f.Freelancer_id = item.freelancer_id;
                CusSavedFreeID.Add(f);
            }
            return(CusSavedFreeID);
        }
        public List <Freelancer> FreelancercardVMList()
        {
            ProjektGruppFEntities1 pgfe = new ProjektGruppFEntities1();
            List <Freelancer>      FreelancerCardList = new List <Freelancer>();
            var cardlist = (from fl_table in pgfe.freelancer
                            join cv_table in pgfe.cv on fl_table.cv_id equals
                            cv_table.cv_id
                            select new
            {
                fl_table.freelancer_id,
                fl_table.firstname,
                fl_table.lastname,
                cv_table.birthday,
                cv_table.nationality,
                cv_table.cv_id
            }).ToList();

            foreach (var item in cardlist)
            {
                DateTime birthdate = item.birthday;
                int      age       = AgeConverter(birthdate);

                Freelancer fcVM = new Freelancer();
                fcVM.Freelancer_id = item.freelancer_id;
                fcVM.Firstname     = item.firstname;
                fcVM.Lastname      = item.lastname;
                fcVM.Age           = age;
                fcVM.Nationality   = item.nationality;
                fcVM.Cv_id         = item.cv_id;
                fcVM.SkillList     = GetSkills(item.cv_id);
                fcVM.ExpertiseList = GetExpertiseList(item.cv_id);
                FreelancerCardList.Add(fcVM);
            }

            return(FreelancerCardList);
        }