Пример #1
0
 public ActionResult CreateVacancy(VacancyViewModel model)
 {
     if (ModelState.IsValid)
     {
         List <long> IdList = new List <long>();
         if (model.NewExperience != null)
         {
             IdList.AddRange(experienceRepository.CreateNewExperience(model.NewExperience));
         }
         if (model.NewExperience == null && model.SelectedExperience == null)
         {
             IdList.AddRange(experienceRepository.CreateNewExperience("Без опыта"));
         }
         if (model.SelectedExperience != null)
         {
             foreach (var e in model.SelectedExperience)
             {
                 IdList.Add(Convert.ToInt64(e));
             }
         }
         var vacancy = new Vacancy
         {
             Ends               = model.Ends,
             Starts             = model.Starts,
             VacancyName        = model.Name,
             Status             = Status.Active,
             VacancyDescription = model.Description,
             Company            = companyRepository.Load(long.Parse(model.SelectedCompany)),
             Requirements       = experienceRepository.GetSelectedExperience(IdList)
         };
         try
         {
             var id = employerRepository.SaveWProcedure(vacancy, Convert.ToInt64(User.Identity.GetUserId()));
             vacancy = employerRepository.Load(id);
             vacancy.Requirements = experienceRepository.GetSelectedExperience(IdList);
             employerRepository.Save(vacancy);
             return(RedirectToAction("Main", "employer"));
         }
         catch
         {
             return(RedirectToAction("Main", "employer"));
         }
     }
     else
     {
         return(RedirectToAction("Main"));
     }
 }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            se.Name1 = textBoxName1.Text.ToString();
            se.Name2 = textBoxName2.Text.ToString();
            se.Name3 = textBoxName3.Text.ToString();
            se.Email = textBoxEmail.Text.ToString();
            se.IDdmp = Int32.Parse(comboBoxDep.SelectedValue.ToString());

            empRepo.Update(se);
            empRepo.Save();
            Close();
        }
 private void buttonSave_Click(object sender, EventArgs e)
 {
     empRepo.Save();
     RefreshGui();
 }