Exemplo n.º 1
0
        public Skill AddToCv(Skill skill, int cvId)
        {
            var cv = _cvContext.Cvs.Include(c => c.Skills).Single(o => o.Id == cvId);

            cv.Skills.Add(skill);
            _cvContext.SaveChanges();
            return(skill);
        }
Exemplo n.º 2
0
        public Company AddToCv(Company company, int cvId)
        {
            var cv = _cvContext.Cvs.Include(c => c.Companies).Single(o => o.Id == cvId);

            cv.Companies.Add(company);
            _cvContext.SaveChanges();
            return(company);
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "ID,Name,Date,Address,Nationality,Phone,Mail,Objective,WhatIDo")] AboutMe aboutMe)
        {
            if (ModelState.IsValid)
            {
                db.AboutMes.Add(aboutMe);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutMe));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "ID,StartDate,StopDate,JobName,CompanyName,Where,Explanation")] Experiance experiance)
        {
            if (ModelState.IsValid)
            {
                db.Experiances.Add(experiance);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(experiance));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ID,StartDate,StopDate,Name,Number,Where,Explanation")] Certificated certificated)
        {
            if (ModelState.IsValid)
            {
                db.Certificateds.Add(certificated);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(certificated));
        }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "ID,Address,Number")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                db.Contacts.Add(contact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "ID,SkillName,IsBest,Match,Level")] Skill skill)
        {
            if (ModelState.IsValid)
            {
                db.Skills.Add(skill);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(skill));
        }
Exemplo n.º 8
0
        public ActionResult Create([Bind(Include = "ID,Name,JobFirstName,JobLastName,Introduction")] Entery entery)
        {
            if (ModelState.IsValid)
            {
                db.Enteries.Add(entery);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(entery));
        }
Exemplo n.º 9
0
        public ActionResult Create([Bind(Include = "ID,StartDate,StopDate,IsContinue,SchoolName,Departmant,Where,Explanation")] Education education)
        {
            if (ModelState.IsValid)
            {
                db.Educations.Add(education);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(education));
        }
 public static void createGeolocationsFromScrapeFile(cvScrapeData data)
 {
     foreach (var geo in data.geoLocations)
     {
         var rec = ctx.GeoLocations.FirstOrDefault(r => r.Name == geo.name);
         if (rec == null)
         {
             var g = new GeoLocation()
             {
                 CreateDate = DateTime.Now,
                 Name       = geo.name
             };
             ctx.GeoLocations.Add(g);
             ctx.SaveChanges();
         }
     }
 }
Exemplo n.º 11
0
 public Cv Add(Cv cv)
 {
     _cvContext.Cvs.Add(cv);
     _cvContext.SaveChanges();
     return(cv);
 }
        public void ImportScrape(cvScrapeData data)
        {
            if (data.heading.Contains("XX,XXX"))
            {
                return;
            }
            var existScrape = ctx.ScrapeRuns.FirstOrDefault(r => r.Heading.Trim() == data.heading.Trim());

            if (existScrape != null)
            {
                return;
            }
            Console.WriteLine("updating...");
            cvDataUtils.createGeolocationsFromScrapeFile(data);
            cvDataUtils.createCountriesFromScrapeFile(data);

            ScrapeRun scrape = new ScrapeRun()
            {
                CreateDate = DateTime.Now,
                Heading    = data.heading,
                ScrapeDate = data.scrapeDate
            };

            ctx.ScrapeRuns.Add(scrape);
            ctx.SaveChanges();

            foreach (var geo in data.geoLocations)
            {
                foreach (var detail in geo.details)
                {
                    var country = ctx.Countries.FirstOrDefault(r => r.Name == detail.country);
                    if (country == null && detail.country != "TOTAL")
                    {
                        throw new Exception("country not found: " + detail.country);
                    }
                    if (detail.country == "TOTAL")
                    {
                        continue;
                    }

                    CountryStats stats = new CountryStats()
                    {
                        ScrapeRunId = scrape.Id,
                        CountryId   = country.Id,
                        CreateDate  = DateTime.Now,
                        CaseCount   = int.Parse(detail.cases.Trim().Replace(",", "").Replace("*", "")),
                        DeathCount  = int.Parse(detail.deaths.Trim().Replace(",", "").Replace("*", "")),
                        Notes       = detail.notes
                    };
                    ctx.CountryStats.Add(stats);
                }
            }
            try
            {
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }