コード例 #1
0
        public LostJobModel Get(string jobId)
        {
            var lostJob = new LostJobModel();

            try
            {
                using (var db = new ResumeContext())
                {
                    var dbJob = db.LostJobs.Where(j => j.Id == jobId).FirstOrDefault();
                    if (dbJob != null)
                    {
                        lostJob.Id               = jobId;
                        lostJob.Employer         = dbJob.Employer;
                        lostJob.JobLocation      = dbJob.JobLocation;
                        lostJob.StartMonth       = dbJob.StartMonth;
                        lostJob.StartYear        = dbJob.StartYear;
                        lostJob.FiredMonth       = dbJob.FiredMonth;
                        lostJob.FiredYear        = dbJob.FiredYear;
                        lostJob.JobTitle         = dbJob.JobTitle;
                        lostJob.Summary          = dbJob.Summary;
                        lostJob.SecretNarative   = dbJob.SecretNarative;
                        lostJob.ReasonForLeaving = dbJob.ReasonForLeaving;
                    }
                }
            }
            catch (Exception ex) { lostJob.Summary = Helpers.ErrorDetails(ex); }
            return(lostJob);
        }
コード例 #2
0
        public CurriculumType(ResumeContext dbContext)
        {
            Field(x => x.Id);
            Field(x => x.Nombre);
            Field(x => x.Email);

            Field <ListGraphType <ExperienciaType> >("experiencia",
                                                     arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "idCurriculum"
            }),
                                                     resolve: context => dbContext.Experiences.Where(x => x.CurriculumId == context.Source.Id),
                                                     description: "Experiencia laboral");

            Field <ListGraphType <EducacionType> >("educacion",
                                                   arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "idCurriculum"
            }),
                                                   resolve: context => dbContext.Educaciones.Where(x => x.CurriculumId == context.Source.Id),
                                                   description: "Educación");

            Field <ListGraphType <CursoType> >("cursos",
                                               arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "idCurriculum"
            }),
                                               resolve: context => dbContext.Cursos.Where(x => x.CurriculumId == context.Source.Id),
                                               description: "Cursos");
        }
コード例 #3
0
        public ResumeQuery(ResumeContext dbContext)
        {
            Field <CurriculumType>(
                "curriculum",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context => dbContext.Curriculum.FirstOrDefault(x => x.Id == context.GetArgument <int>("id", 0)));

            Field <ListGraphType <CurriculumType> >(
                "curriculums",
                resolve: context => dbContext.Curriculum);

            Field <ListGraphType <ExperienciaType> >(
                "experiencias",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "contiene"
            }),
                resolve: context => context.GetArgument <string>("contiene", null) == null ?
                dbContext.Experiences :
                dbContext.Experiences.Where(x => x.Cargo.Contains(context.GetArgument <string>("contiene", null))));

            Field <ListGraphType <EducacionType> >(
                "educaciones",
                resolve: context => dbContext.Educaciones);

            Field <ListGraphType <CursoType> >(
                "cursos",
                resolve: context => dbContext.Cursos);
        }
コード例 #4
0
        public ActionResult <Opportunity> UpdateResume(int id, Resume resume)
        {
            if (resume == null || id != resume.Id)
            {
                return(new BadRequestResult());
            }

            using (var context = new ResumeContext())
            {
                var existing = GetById(id, context);
                if (existing == null)
                {
                    return(NotFound("No resume exists with that ID or you do not have access to it."));
                }

                existing.EmailAddress        = resume.EmailAddress;
                existing.FirstName           = resume.FirstName;
                existing.LastName            = resume.LastName;
                existing.HomePostalCode      = resume.HomePostalCode;
                existing.RequiresRelocation  = resume.RequiresRelocation;
                existing.RequiresRemote      = resume.RequiresRemote;
                existing.RequiresSponsorship = resume.RequiresSponsorship;

                // TODO: This should also update desired skills, potentially
                context.SaveChanges();

                return(Ok(existing));
            }
        }
コード例 #5
0
        public List <ResumeElementModel> GetAvailable(string personId, string resumeId)
        {
            List <ResumeElementModel> availableElements = new List <ResumeElementModel>();

            using (var db = new ResumeContext())
            {
                List <string> selectedElements = db.ResumeElements.Where(e => e.ElementId == resumeId).Select(e => e.ElementId).ToList();

                List <string> availableJobElementIds = db.LostJobs.Where(j => j.PersonId == personId).Select(j => j.Id).Except(selectedElements).ToList();
                availableElements = (from jobs in db.LostJobs
                                     where availableJobElementIds.Contains(jobs.Id)
                                     select new ResumeElementModel()
                {
                    ElementId = jobs.Id,
                    ElementName = jobs.Employer,
                    ElementType = "JOB"
                }).ToList();

                var availableResumeSectionElemenIds = db.ResumeSections.Where(s => s.PersonId == personId).Select(s => s.Id).Except(selectedElements).ToList();
                var availableSections = (from sections in db.ResumeSections
                                         where availableResumeSectionElemenIds.Contains(sections.Id)
                                         select new ResumeElementModel()
                {
                    ElementId = sections.Id,
                    ElementName = sections.SectionTitle,
                    ElementType = "SEC"
                }).ToList();

                availableElements = availableElements.Concat(availableSections).ToList();
            }
            return(availableElements.OrderByDescending(r => r.ElementType).ToList());
        }
コード例 #6
0
 public DataContext.Resume GetOne(string resumeId)
 {
     using (var db = new ResumeContext())
     {
         return(db.Resumes.Where(r => r.Id == resumeId).FirstOrDefault());
     }
 }
コード例 #7
0
        public string Put(LostJobModel editedJob)
        {
            string success = "";

            try
            {
                using (var db = new ResumeContext())
                {
                    var job = db.LostJobs.Where(j => j.Id == editedJob.Id).FirstOrDefault();
                    if (job == null)
                    {
                        success = "record not found";
                    }
                    else
                    {
                        job.StartMonth       = editedJob.StartMonth;
                        job.StartYear        = editedJob.StartYear;
                        job.FiredMonth       = editedJob.FiredMonth;
                        job.FiredYear        = editedJob.FiredYear;
                        job.JobTitle         = editedJob.JobTitle;
                        job.Employer         = editedJob.Employer;
                        job.JobLocation      = editedJob.JobLocation;
                        job.Summary          = editedJob.Summary;
                        job.ReasonForLeaving = editedJob.ReasonForLeaving;
                        job.SecretNarative   = editedJob.SecretNarative;

                        db.SaveChanges();
                        success = "ok";
                    }
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
コード例 #8
0
        public List <LostJobModel> ManyGet(string personId)
        {
            var lostJobs = new List <LostJobModel>();

            using (var db = new ResumeContext())
            {
                var dbJobs = db.LostJobs.Where(j => j.PersonId == personId).OrderByDescending(j => j.StartYear).ThenByDescending(j => j.StartMonth).ToList();
                foreach (LostJob lostjob in dbJobs)
                {
                    lostJobs.Add(new LostJobModel()
                    {
                        Id               = lostjob.Id,
                        ElementId        = lostjob.Id,
                        JobTitle         = lostjob.JobTitle,
                        Employer         = lostjob.Employer,
                        StartMonth       = Helpers.DateName(lostjob.StartMonth),
                        StartYear        = lostjob.StartYear,
                        FiredMonth       = Helpers.DateName(lostjob.FiredMonth),
                        FiredYear        = lostjob.FiredYear,
                        JobLocation      = lostjob.JobLocation,
                        ReasonForLeaving = lostjob.ReasonForLeaving,
                        SecretNarative   = lostjob.SecretNarative,
                        Summary          = lostjob.Summary
                    });
                }
            }
            return(lostJobs);
        }
コード例 #9
0
        public ActionResult <Opportunity> UpdateOpportunity(int id, Opportunity opportunity)
        {
            if (opportunity == null || id != opportunity.Id)
            {
                return(new BadRequestResult());
            }

            using var context = new ResumeContext();

            var existing = GetById(id, context);

            if (existing == null)
            {
                return(NotFound("No opportunity exists with that ID or you do not have access to it."));
            }

            existing.Company    = opportunity.Company;
            existing.JobTitle   = opportunity.JobTitle;
            existing.PostalCode = opportunity.PostalCode;

            // TODO: This should also update desired skills, potentially
            context.SaveChanges();

            return(Ok(existing));
        }
コード例 #10
0
        public static void Initialize(ResumeContext context)
        {
            // Uncomment to clear database each time.
            //context.Database.EnsureDeleted();
            if (context.Database.EnsureCreated())
            {
                Person      me          = GeneratePerson();
                CodeSnippet codeSnippet = new CodeSnippet()
                {
                    Name     = "Test Example",
                    RepoLink = "Test",
                    Snippet  = "public static int Test(){\nint test = 1\n}\n"
                };

                List <CodeSnippet> codeSnippets = new List <CodeSnippet>()
                {
                    codeSnippet
                };
                List <ExperienceHistory> experienceHistories = new List <ExperienceHistory>()
                {
                    GetRaytheonHistory(), GetGoDaddyHistory()
                };

                Resume resume = new Resume()
                {
                    Person = me,
                    ProfessionalExperienceHistories = experienceHistories,
                    EducationHistory = GetEducationHistory(),
                    ProjectsHistory  = GetProjectsHistory(),
                    CodeSnippets     = codeSnippets
                };

                context.AddResume(resume).Wait();
            }
        }
コード例 #11
0
        public ActionResult <List <Opportunity> > GetOpportunities()
        {
            using var context = new ResumeContext();
            InitOpportunitiesIfNeeded(context);

            return(Ok(context.Opportunities.Include(o => o.DesiredSkills).ToList()));
        }
コード例 #12
0
        public List <ResumeSectionModel> GetMany(string personId)
        {
            var resumeSectionModels = new List <ResumeSectionModel>();

            try
            {
                using (var db = new ResumeContext())
                {
                    resumeSectionModels =
                        (from sections in db.ResumeSections
                         where (sections.PersonId == personId)
                         //join crefs in db.Refs on sections.SectionType equals crefs.RefCode into sr
                         //from xrefs in sr.DefaultIfEmpty()
                         select new ResumeSectionModel
                    {
                        Id = sections.Id,
                        SectionTitle = sections.SectionTitle,
                        //SectionType = sections.SectionType,
                        //SectionTypeDescription = xrefs.RefDescription == null ? "" : xrefs.RefDescription,
                    }).ToList();
                }
            }
            catch (Exception ex) { resumeSectionModels.Add(new ResumeSectionModel()
                {
                    SectionTitle = Helpers.ErrorDetails(ex)
                }); }
            return(resumeSectionModels);
        }
コード例 #13
0
        public string Put(ResumeSectionModel editedSection)
        {
            string success = "";

            try
            {
                using (var db = new ResumeContext())
                {
                    var Section = db.ResumeSections.Where(j => j.Id == editedSection.Id).FirstOrDefault();
                    if (Section == null)
                    {
                        success = "record not found";
                    }
                    else
                    {
                        //Section.SectionType = editedSection.SectionType;
                        Section.SectionTitle    = editedSection.SectionTitle;
                        Section.SectionContents = editedSection.SectionContents;

                        db.SaveChanges();
                        success = "ok";
                    }
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
コード例 #14
0
 public DbInitializer(ResumeContext resumeContext,
                      ILogger <DbInitializer> logger,
                      UserAuthentication authentication)
 {
     _resumeContext  = resumeContext;
     _logger         = logger;
     _authentication = authentication;
 }
コード例 #15
0
 public DbOperations(ResumeContext resumeContext,
                     FileOperations fileOperations,
                     ILogger <DbOperations> logger)
 {
     _resumeContext  = resumeContext;
     _fileOperations = fileOperations;
     _logger         = logger;
 }
コード例 #16
0
        public ActionResult <List <Resume> > GetResumes()
        {
            using (var context = new ResumeContext())
            {
                InitResumesIfNeeded(context);

                return(Ok(context.Resumes.Include(r => r.Educations).Include(r => r.Jobs).ToList()));
            }
        }
コード例 #17
0
 public CursoType(ResumeContext dbContext)
 {
     Field(x => x.Id);
     Field(x => x.CurriculumId);
     Field(x => x.Nombre);
     Field <ListGraphType <CurriculumType> >("curriculum",
                                             arguments: new QueryArguments(new QueryArgument <IntGraphType> {
         Name = "idCurriculum"
     }),
                                             resolve: context => dbContext.Curriculum.Where(x => x.Id == context.Source.CurriculumId),
                                             description: "Curriculum");
 }
コード例 #18
0
 public EducacionType(ResumeContext dbContext)
 {
     Field(x => x.CurriculumId);
     Field(x => x.Establecimiento);
     Field <EducacionNivelEnumType>("nivel", resolve: context => context.Source.Nivel);
     Field <ListGraphType <CurriculumType> >("curriculum",
                                             arguments: new QueryArguments(new QueryArgument <IntGraphType> {
         Name = "idCurriculum"
     }),
                                             resolve: context => dbContext.Curriculum.Where(x => x.Id == context.Source.CurriculumId),
                                             description: "Curriculum");
 }
コード例 #19
0
        public ActionResult <Opportunity> GetOpportunity(int id)
        {
            using var context = new ResumeContext();
            InitOpportunitiesIfNeeded(context);

            var match = GetById(id, context);

            if (match != null)
            {
                return(Ok(match));
            }

            return(NotFound("No opportunity exists with that ID or you do not have access to it."));
        }
コード例 #20
0
        public ResumeModel GetLoadedResume(string resumeId)
        {
            var fullyLoadedResume = new ResumeModel();

            fullyLoadedResume.Id = resumeId;
            using (var db = new ResumeContext())
            {
                var dbResume = db.Resumes.Where(r => r.Id == resumeId).FirstOrDefault();
                fullyLoadedResume.ResumeName = dbResume.ResumeName;

                fullyLoadedResume.TopSections = (from e in dbResume.ResumeElements.Where(e => e.ElementType == "1")
                                                 join dbSections in db.ResumeSections on e.ElementId equals dbSections.Id
                                                 orderby e.SortOrder
                                                 select new ResumeSectionModel()
                {
                    SortOrder = e.SortOrder,
                    Id = e.ElementId,
                    SectionTitle = dbSections.SectionTitle,
                    SectionContents = dbSections.SectionContents
                }).ToList();
                fullyLoadedResume.LostJobs = (from e in dbResume.ResumeElements.Where(e => e.ElementType == "2")
                                              join dbJob in db.LostJobs on e.ElementId equals dbJob.Id
                                              orderby e.SortOrder
                                              select new LostJobModel()
                {
                    SortOrder = e.SortOrder,
                    ElementId = dbJob.Id,
                    Employer = dbJob.Employer,
                    JobLocation = dbJob.JobLocation,
                    StartMonth = Helpers.DateName(dbJob.StartMonth),
                    StartYear = dbJob.StartYear,
                    FiredMonth = Helpers.DateName(dbJob.FiredMonth),
                    FiredYear = dbJob.FiredYear,
                    JobTitle = dbJob.JobTitle,
                    Summary = dbJob.Summary
                }).ToList();
                fullyLoadedResume.BottomSections = (from e in dbResume.ResumeElements.Where(e => e.ElementType == "3")
                                                    join dbResumeSections in db.ResumeSections on e.ElementId equals dbResumeSections.Id
                                                    orderby e.SortOrder
                                                    select new ResumeSectionModel()
                {
                    SortOrder = e.SortOrder,
                    Id = e.ElementId,
                    SectionTitle = dbResumeSections.SectionTitle,
                    SectionContents = dbResumeSections.SectionContents
                }).ToList();
            }
            return(fullyLoadedResume);
        }
コード例 #21
0
        public async Task <IActionResult> CreateEducation(Education Model, [FromServices] ResumeContext DB)
        {
            DB.Educations.Add(Model);
            var entry = DB.Entry(Model);
            await DB.SaveChangesAsync();

            return(Prompt(x =>
            {
                x.Title = SR["Succeeded"];
                x.Details = SR["Education experience has been created successfully."];
                x.HideBack = true;
                x.RedirectText = SR["Back To Education List"];
                x.RedirectUrl = Url.Action("Education", "Admin");
            }));
        }
コード例 #22
0
        public ActionResult <Resume> GetResume(int id)
        {
            using (var context = new ResumeContext())
            {
                InitResumesIfNeeded(context);

                var match = GetById(id, context);

                if (match != null)
                {
                    return(Ok(match));
                }

                return(NotFound("No resume exists with that ID or you do not have access to it."));
            }
        }
コード例 #23
0
        public ActionResult <Resume> CreateResume(Resume opportunity)
        {
            if (opportunity == null)
            {
                return(new BadRequestResult());
            }

            using (var context = new ResumeContext())
            {
                var result = context.Resumes.Add(opportunity);
                context.SaveChanges();

                // TODO: This really should return a full URL starting relative to the controller
                return(Created($"/api/resumes/{result.Entity.Id}", result.Entity));
            }
        }
コード例 #24
0
ファイル: Global.asax.cs プロジェクト: ksirmons/Resume
        protected void Application_Start()
        {
            var initializeDatabase = new ResumeContext().UserProfiles.Where(u => u.UserId == 1);

            Bootstrapper.Initialise();

            AutoMapperRegistrations.Initialize();

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
コード例 #25
0
 public ResumeController(ResumeContext resumeContext,
                         DbOperations dbOperations,
                         FileOperations fileOperations,
                         UserAuthentication userAuthentication,
                         IWebHostEnvironment appEnvironment,
                         ILogger <ResumeController> logger,
                         EmailOperations emailOperations
                         )
 {
     _resumeContext      = resumeContext;
     _dbOperations       = dbOperations;
     _userAuthentication = userAuthentication;
     _logger             = logger;
     _fileOperations     = fileOperations;
     _emailOperations    = emailOperations;
     pathRoot            = appEnvironment.WebRootPath;
 }
コード例 #26
0
        public static string ShowResume()
        {
            using (ResumeContext context = new ResumeContext())
            {
                var resume1 = (from cil in context.ContactInformationLists select cil).ToString();
                var resume2 = (from el in context.EducationLists select el).ToString();
                var resume3 = (from pil in context.PersonalIntroductionLists select pil).ToString();
                var resume4 = (from pql in context.PersonalQualitiesLists select pql).ToString();
                var resume5 = (from ppl in context.PortfolioProjectsLists select ppl).ToString();
                var resume6 = (from pll in context.ProgrammingLanguagesLists select pll).ToString();
                var resume7 = (from ptl in context.ProgrammingToolsLists select ptl).ToString();
                var resume8 = (from we in context.WorkExperienceLists select we).ToString();
                var resume  = resume1 + resume2 + resume3 + resume4 + resume5 + resume6 + resume7 + resume8;

                return(resume);
            }
        }
コード例 #27
0
        public ActionResult <Opportunity> DeleteOpportunity(int id)
        {
            using var context = new ResumeContext();
            InitOpportunitiesIfNeeded(context);

            var match = GetById(id, context);;

            if (match != null)
            {
                context.Opportunities.Remove(match);
                context.SaveChanges();

                return(Ok());
            }

            return(NotFound("No opportunity exists with that ID or you do not have access to it."));
        }
コード例 #28
0
        public string Post(LostJob newJob)
        {
            string success = "";

            try
            {
                using (var db = new ResumeContext())
                {
                    newJob.Id = Guid.NewGuid().ToString();
                    db.LostJobs.Add(newJob);
                    db.SaveChanges();
                    success = newJob.Id.ToString();
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
コード例 #29
0
        public List <ResumeModel> Get(string personId)
        {
            var rm = new List <ResumeModel>();

            using (var db = new ResumeContext())
            {
                var dbResumes = db.Resumes.Where(r => r.PersonId == personId).ToList();
                foreach (DataContext.Resume dbResume in dbResumes)
                {
                    rm.Add(new ResumeModel()
                    {
                        Id = dbResume.Id, ResumeName = dbResume.ResumeName, Created = dbResume.Created.ToShortDateString()
                    });
                }
            }
            return(rm);
        }
コード例 #30
0
        public ExperienciaType(ResumeContext dbContext)
        {
            Field(x => x.Id);
            Field(x => x.CurriculumId);
            Field(x => x.Empresa);
            Field(x => x.Cargo);
            Field(x => x.DescripcionTareas);
            Field <StringGraphType>("fechaInicio", resolve: context => context.Source.FechaInicio?.ToShortDateString());
            Field <StringGraphType>("fechaFin", resolve: context => context.Source.FechaFin?.ToShortDateString());

            Field <ListGraphType <CurriculumType> >("curriculum",
                                                    arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "idCurriculum"
            }),
                                                    resolve: context => dbContext.Curriculum.Where(x => x.Id == context.Source.CurriculumId),
                                                    description: "Curriculum");
        }
コード例 #31
0
ファイル: ResumeRepository.cs プロジェクト: ksirmons/Resume
 public ResumeRepository(ResumeContext context)
 {
     this.context = context;
 }