Пример #1
0
        public static void AddResumeData(ResumeDbContext context, string dateFolder)
        {
            try
            {
                if (dateFolder[0] == 'd')
                {
                    ResumeFiles files = new ResumeFiles(dateFolder);

                    // Utilities.LoadType<Resume>(context, files.Resume, writeJson);

                    if (File.Exists(files.Resume))
                    {
                        Resume resume = Utilities.SerializeYml <Resume>(files.Resume);
                        context.Add(resume);
                    }

                    if (File.Exists(files.Education))
                    {
                        EducationJson     educationJson = Utilities.SerializeYml <EducationJson>(files.Education);
                        IList <Education> educations    = educationJson.Educations;
                        AddItems(context, educations);
                    }
                    if (File.Exists(files.Job))
                    {
                        JobJson     jobJson = Utilities.SerializeYml <JobJson>(files.Job);
                        IList <Job> jobs    = jobJson.Jobs;
                        AddItems(context, jobs);
                    }
                    if (File.Exists(files.Skill))
                    {
                        SkillJson     skillJson = Utilities.SerializeYml <SkillJson>(files.Skill);
                        IList <Skill> skills    = skillJson.Skills;
                        AddItems(context, skills);
                    }
                    if (File.Exists(files.Social))
                    {
                        SocialJson     socialJson = Utilities.SerializeYml <SocialJson>(files.Social);
                        IList <Social> socials    = socialJson.Socials;
                        AddItems(context, socials);
                    }
                    if (File.Exists(files.SpokenLanguages))
                    {
                        SpokenLanguagesJson     spokenLanguagesJson = Utilities.SerializeYml <SpokenLanguagesJson>(files.SpokenLanguages);
                        IList <SpokenLanguages> spokenLanguages     = spokenLanguagesJson.SpokenLanguages;
                        AddItems(context, spokenLanguages);
                    }

                    context.SaveChanges();
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("##############################");
                Console.WriteLine("Resume Data Add Fail");
                Console.WriteLine(e);
            }
        }
Пример #2
0
        public static void Seed(ResumeDbContext context)
        {
            AddItems(context, EducationJson.LoadJson("Data/Seed/carlos_resume_educations.json").Educations);
            AddItems(context, JobJson.LoadJson("Data/Seed/carlos_resume_jobs.json").Jobs);
            context.Add(Resume.LoadJson("Data/Seed/carlos_resume_about.json"));
            AddItems(context, SkillJson.LoadJson("Data/Seed/carlos_resume_skills.json").Skills);
            AddItems(context, SocialJson.LoadJson("Data/Seed/carlos_resume_socials.json").Socials);
            AddItems(context, SpokenLanguagesJson.LoadJson("Data/Seed/carlos_resume_languages.json").SpokenLanguages);
            context.SaveChanges();

            AddItems(context, ResumeEducationsJson.LoadJson("Data/Seed/carlos_resume_resumeeducations.json").ResumeEducations);
            AddItems(context, ResumeJobsJson.LoadJson("Data/Seed/carlos_resume_resumejobs.json").ResumeJobs);
            AddItems(context, ResumeSkillsJson.LoadJson("Data/Seed/carlos_resume_resumeskills.json").ResumeSkills);
            AddItems(context, ResumeSocialsJson.LoadJson("Data/Seed/carlos_resume_resumesocials.json").ResumeSocials);
            AddItems(context, ResumeSpokenLanguagesJson.LoadJson("Data/Seed/carlos_resume_resumespokenlanguages.json").ResumeSpokenLanguages);
            context.SaveChanges();
        }