Exemplo n.º 1
0
            protected override void Seed(CandidateDbContext context)
            {
                var candidate1 = new Candidate()
                {
                    FirstName      = "Cooper",
                    LastName       = "Leibow",
                    Email          = "*****@*****.**",
                    ZipCode        = "77007",
                    PhoneNumber    = "2144040949",
                    Qualifications = new List <Qualification>()
                    {
                        new Qualification()
                        {
                            Type          = "Work Experience",
                            DateStarted   = new DateTime(2011, 1, 1),
                            DateCompleted = new DateTime(2012, 1, 1),
                            CandidateID   = 1,
                            ID            = 1
                        }
                    }
                };


                context.Candidates.Add(candidate1);
                context.SaveChanges();
                base.Seed(context);
            }
 public List <CandidateDTO> GetCandidates(CandidateSearchParams searchParams)
 {
     using (var context = new CandidateDbContext())
     {
         var candidateDtos = _candidateRepository.GetCandidates(context, searchParams);
         return(candidateDtos);
     }
 }
 public bool SaveQualification(Qualification qualification)
 {
     using (var context = new CandidateDbContext())
     {
         var success = false;
         if (qualification != null && qualification.CandidateID != 0 && qualification.DateStarted != null &&
             qualification.DateCompleted != null && !string.IsNullOrEmpty(qualification.Name) && !string.IsNullOrEmpty(qualification.Type))
         {
             success = _candidateRepository.SaveQualification(context, qualification);
         }
         return(success);
     }
 }
        public bool SaveCandidate(Candidate candidate)
        {
            using (var context = new CandidateDbContext())
            {
                var success = false;
                if (candidate != null && !string.IsNullOrEmpty(candidate.FirstName) && !string.IsNullOrEmpty(candidate.LastName) &&
                    !string.IsNullOrEmpty(candidate.Email) && !string.IsNullOrEmpty(candidate.PhoneNumber) && !string.IsNullOrEmpty(candidate.ZipCode))
                {
                    success = _candidateRepository.SaveCandidates(context, candidate);
                }

                return(success);
            }
        }