Пример #1
0
        public ActionResult AddSection(int pageId, string selectedValue)
        {
            var page = _webPageService.GetById(pageId);

            Section section = null;

            switch (selectedValue.ToLower())
            {
            case "htmlcontent":
                section = new HtmlContentSection();
                break;

            case "contactform":
                section = new ContactFormSection {
                    EmailTo = "*****@*****.**"
                };
                break;

            case "resume":
                section = new ResumeSection {
                    ApplicationUserName = HttpContext.User.Identity.Name
                };
                break;
            }

            section.WebPage = page;
            _sectionService.Insert(section);

            return(NoContent());
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ResumeSection resumeSection = db.ResumeSection.Find(id);

            db.ResumeSection.Remove(resumeSection);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ResumeSection UpdateResumeSection(ResumeSection inputSection)
 {
     using (var context = DbContext)
     {
         context.Entry(inputSection).State = EntityState.Modified;
         context.SaveChanges();
         return(context.Entry(inputSection).Entity);
     }
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "Id,ResumeId,ContentHeader, Sorter")] ResumeSection resumeSection)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resumeSection).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ResumeId = new SelectList(db.Resume, "Id", "ResumeHeader", resumeSection.ResumeId);
     return(View(resumeSection));
 }
Пример #5
0
        // GET: ResumeSections/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ResumeSection resumeSection = db.ResumeSection.Find(id);

            if (resumeSection == null)
            {
                return(HttpNotFound());
            }
            return(View(resumeSection));
        }
Пример #6
0
        // GET: ResumeSections/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ResumeSection resumeSection = db.ResumeSection.Find(id);

            if (resumeSection == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ResumeId = new SelectList(db.Resume, "Id", "ResumeHeader", resumeSection.ResumeId);
            return(View(resumeSection));
        }
Пример #7
0
        /// <summary>
        /// Gets the full text for a specific section in <see cref="ResumeMetadata.FoundSections"/>.
        /// </summary>
        /// <param name="exts"></param>
        /// <param name="section">The section to get the text for</param>
        public static string GetSectionText(this ParseResumeResponseExtensions exts, ResumeSection section)
        {
            if (section == null)
            {
                return(null);
            }

            string[] lines = exts.Response.Value.ResumeData?.ResumeMetadata?.PlainText?.Split('\n');

            if (lines != null && lines.Length > section.FirstLineNumber && lines.Length > section.LastLineNumber)
            {
                return(string.Join("\n", lines
                                   .Skip(section.FirstLineNumber)
                                   .Take((section.LastLineNumber - section.FirstLineNumber) + 1)));
            }

            return(null);
        }
Пример #8
0
        public List <ResumeElementModel> Get(string resumeId)
        {
            var resumeElements = new List <ResumeElementModel>();

            using (var db = new ResumeContext())
            {
                var dbElements = db.ResumeElements.Where(e => e.ResumeId == resumeId).ToList();
                foreach (ResumeElement element in dbElements)
                {
                    var m = new ResumeElementModel();
                    if (element.ElementType == "2")
                    {
                        LostJob lostJob = db.LostJobs.Where(j => j.Id == element.ElementId).FirstOrDefault();
                        if (lostJob != null)
                        {
                            m.ElementName = lostJob.Employer;
                        }
                        else
                        {
                            m.ElementName = "??";
                        }
                    }
                    else
                    {
                        ResumeSection x = db.ResumeSections.Where(s => s.Id == element.ElementId).FirstOrDefault();
                        if (x != null)
                        {
                            m.ElementName = x.SectionTitle;
                        }
                        else
                        {
                            m.ElementName = "?";
                        }
                    }
                    m.ElementId   = element.ElementId.ToString();
                    m.ElementType = element.ElementType;
                    m.SortOrder   = element.SortOrder;
                    resumeElements.Add(m);
                }
            }
            return(resumeElements.OrderBy(r => r.ElementType).ThenBy(r => r.SortOrder).ToList());
        }
Пример #9
0
        public string Post(ResumeSectionModel newSection)
        {
            string success = "ERROR: ";

            try
            {
                ResumeSection section = new ResumeSection();
                section.Id           = Guid.NewGuid().ToString();
                section.PersonId     = newSection.PersonId;
                section.SectionTitle = newSection.SectionTitle;
                //section.SectionType = "";
                section.SectionContents = newSection.SectionContents;
                using (var db = new ResumeContext())
                {
                    db.ResumeSections.Add(section);
                    db.SaveChanges();
                    success = section.Id.ToString();
                }
            }
            catch (Exception ex) { success += Helpers.ErrorDetails(ex); }
            return(success);
        }
Пример #10
0
        protected override void Seed(ResumeContext context)
        {
            Resume seedres = new Resume()
            {
                ResumeHeader      = "Tobias Balzano, CV",
                ResumeSections    = new List <ResumeSection>(),
                ResumeContactInfo = new ResumeContactInfo()
            };
            ResumeContactInfo ResumeContactInfo = new ResumeContactInfo
            {
                Address       = "Addressvägen 1",
                Email         = "*****@*****.**",
                Name          = "Förnamn Efternamn",
                Phone         = "Phone",
                ExternalLink1 = "http://www.youtube.com",
                Github        = "github.com/tobiasbalzano",
                Photo         = "/images/portraits/t_b_lrg.jpg",
                WebPage       = "http://www.tobiasbalzano.se",
            };

            seedres.ResumeContactInfo = ResumeContactInfo;


            ResumeSection work = new ResumeSection
            {
                ContentHeader = "Work",
                Entries       = new List <ResumeEntry>(),
                Resume        = seedres
            };

            ResumeSection edu = new ResumeSection
            {
                ContentHeader = "Education",
                Entries       = new List <ResumeEntry>(),
                Resume        = seedres
            };

            seedres.ResumeSections.Add(work);
            seedres.ResumeSections.Add(edu);



            ResumeEntry adfahrer = new ResumeEntry()
            {
                ResumeSection   = work,
                Role            = "Programmer",
                Establishment   = "Adfahrer Ab",
                Additional      = "Part time",
                CurrentPosition = true,
                StartDate       = DateTime.Now.AddYears(-2).AddMonths(-3).AddDays(-27),
                EndDate         = DateTime.Now,
                Description     = "Programmerare på adfahrer",
                Tags            = new List <ResumeTag>(),
                Sorter          = 1005
            };


            ResumeEntry fritiden = new ResumeEntry()
            {
                ResumeSection   = work,
                Role            = "Programmer",
                Establishment   = "Fritiden",
                Additional      = "Part time",
                CurrentPosition = true,
                StartDate       = DateTime.Now.AddYears(-2).AddMonths(-3).AddDays(-27),
                EndDate         = DateTime.Now,
                Description     = "Programmerare på Fritiden",
                Tags            = new List <ResumeTag>(),
                Sorter          = 1001
            };


            ResumeEntry teknikh = new ResumeEntry()
            {
                ResumeSection   = edu,
                Role            = "Programmer .net",
                Establishment   = "Tekniklhögskolan",
                Additional      = "Part time",
                CurrentPosition = false,
                StartDate       = DateTime.Now.AddYears(-2).AddMonths(-3).AddDays(-27),
                EndDate         = DateTime.Now,
                Description     = "Utbildning",
                Tags            = new List <ResumeTag>(),
                Sorter          = 1000
            };

            ResumeTag tagone = new ResumeTag()
            {
                Tag           = "C#",
                ResumeEntries = new List <ResumeEntry>()
            };

            ResumeTag tagtwo = new ResumeTag()
            {
                Tag           = "Asp .Net",
                ResumeEntries = new List <ResumeEntry>()
            };

            tagone.ResumeEntries.Add(adfahrer);
            tagone.ResumeEntries.Add(fritiden);
            tagone.ResumeEntries.Add(teknikh);

            tagtwo.ResumeEntries.Add(adfahrer);
            tagtwo.ResumeEntries.Add(fritiden);
            tagtwo.ResumeEntries.Add(teknikh);

            adfahrer.Tags.Add(tagone);
            adfahrer.Tags.Add(tagtwo);
            fritiden.Tags.Add(tagone);
            fritiden.Tags.Add(tagtwo);
            teknikh.Tags.Add(tagone);
            teknikh.Tags.Add(tagtwo);

            seedres.ResumeSections.First(o => o.ContentHeader == "Work").Entries.Add(adfahrer);
            seedres.ResumeSections.First(o => o.ContentHeader == "Work").Entries.Add(fritiden);
            seedres.ResumeSections.First(o => o.ContentHeader == "Education").Entries.Add(teknikh);

            context.Resumes.Add(seedres);
            context.SaveChanges();
        }
Пример #11
0
 public ResumeSection PutResumeSection(ResumeSection inputSection)
 {
     return(repo.UpdateResumeSection(inputSection));
 }
Пример #12
0
 public ResumeSection PostResumeSection(ResumeSection inpuSection)
 {
     return(repo.CreateResumeSection(inpuSection));
 }
Пример #13
0
 public HttpResponseMessage Put(ResumeSection inputSection)
 {
     return(ReturnObjectService.BuildContentResponseMessage(Service.PutResumeSection(inputSection)));
 }
Пример #14
0
 public static ResumeSection ToEntity(this ResumeSectionModel model, ResumeSection destination)
 {
     return(model.MapTo(destination));
 }
Пример #15
0
 public static ResumeSectionModel ToModel(this ResumeSection entity)
 {
     return(entity.MapTo <ResumeSection, ResumeSectionModel>());
 }