Esempio n. 1
0
 public void SendInvitation(Employee employee, Vacancy vacancy, string comment)
 {
     using (var context = new Context())
     {
         var invitation = new Invitation()
         {
             Employee_ = context.Employee_.FirstOrDefault(x => x.Login == employee.Login),
             Vacancy   = context.Vacancy_.FirstOrDefault(m => m.Id == vacancy.Id),
             Interview = comment
         };
         if (employee.Invitations == null)
         {
             context.Employee_.FirstOrDefault(x => x.Login == employee.Login).Invitations = new List <Invitation>();
         }
         context.Employee_.FirstOrDefault(x => x.Login == employee.Login).Invitations.Add(invitation);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
 public Resume AddResume(Employee employee, string commentary, Vacancy vacancy, Employer employer)
 {
     using (var context = new Context())
     {
         var resume = new Resume()
         {
             Employee   = context.Employee_.FirstOrDefault(x => x.Login == employee.Login),
             Age        = GetAge(employee),
             Commentary = commentary,
             Vacancy    = context.Vacancy_.FirstOrDefault(x => x.Id == vacancy.Id)
         };
         if (employer.Resumes == null)
         {
             context.Employer_.FirstOrDefault(x => x.Login == employer.Login).Resumes = new List <Resume>();
         }
         context.Employer_.FirstOrDefault(x => x.Login == employer.Login).Resumes.Add(resume);
         context.SaveChanges();
         return(resume);
     }
 }
Esempio n. 3
0
 public void AddVacancy(Employer employer, string vacancyname, string salary, string adress, string number, string contactperson, Specialization sp)
 {
     using (var context = new Context())
     {
         var vacanc = new Vacancy()
         {
             VacancyName    = vacancyname,
             Salary         = salary,
             Address        = adress,
             Number         = number,
             ContactPerson  = contactperson,
             Specialization = context.Specializations_.FirstOrDefault(x => x.Id == sp.Id),
             Employer       = context.Employer_.FirstOrDefault(m => m.Login == employer.Login)
         };
         if (employer.Vacancies == null)
         {
             context.Employer_.FirstOrDefault(x => x.Login == employer.Login).Vacancies = new List <Vacancy>();
         }
         context.Vacancy_.Add(vacanc);
         context.SaveChanges();
     }
 }