Exemplo n.º 1
0
        public ActionResult RemoveUser(string id)
        {
            UserReposit  userReposit = new UserReposit();
            List <Users> LUsers      = new List <Users>();
            var          user        = userReposit.GetId(Int32.Parse(id));

            userReposit.Delete(user);
            //Если пользователь работник
            if (user.RoleName == "Employee")
            {
                VacancyReposit vacancyReposit = new VacancyReposit();
                List <Vacancy> LVacancy       = new List <Vacancy>();
                LVacancy = vacancyReposit.GetVacancy(user.Login);
                foreach (var item in LVacancy)
                {
                    vacancyReposit.Delete(item);
                }
            }
            //Если ищущий работу
            if (user.RoleName == "Jobseeker")
            {
                CondidateReposit condidateReposit = new CondidateReposit();
                Condidate        condidate        = new Condidate();
                condidate = condidateReposit.GetLogin(user.Login);
                condidateReposit.Delete(condidate);
            }


            user   = userReposit.GetLogin(User.Identity.Name);
            LUsers = userReposit.GetALL();
            LUsers = LUsers.Where(x => x.RoleName != "admin").ToList();
            return(View("MasterRoom", LUsers));
        }
Exemplo n.º 2
0
 public void Delete(Condidate Con)
 {
     using (ISession session = HibernateHelper.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Delete(Con);
             transaction.Commit();
         }
     }
 }
Exemplo n.º 3
0
        public ActionResult RegCon()
        {
            CondidateReposit condidateReposit = new CondidateReposit();
            var         Con         = new Condidate();
            UserReposit userReposit = new UserReposit();
            var         user        = userReposit.GetLogin(User.Identity.Name);

            Con = condidateReposit.GetLogin(user.Login);
            CondidateModel condidateModel = new CondidateModel();

            if (user.CountSummary == true)
            {
                condidateModel.FIO        = Con.FIO;
                condidateModel.DataBirth  = Con.DataBirth;
                condidateModel.experience = Con.experience;
                condidateModel.Skill      = Con.Skill;
                condidateModel.Telephone  = Con.Telephone;
                condidateModel.City       = Con.City;
                condidateModel.NameAutor  = Con.NameAutor;
            }
            return(View(condidateModel));
        }
Exemplo n.º 4
0
        public ActionResult RegCon(CondidateModel model)
        {
            if (ModelState.IsValid)
            {
                var Con = new Condidate();
                CondidateReposit condidateReposit = new CondidateReposit();
                //Проверка было ли создано резюме
                UserReposit userReposit = new UserReposit();
                var         user        = userReposit.GetLogin(User.Identity.Name);
                if (user.CountSummary == true)
                {
                    Con = condidateReposit.GetLogin(user.Login);
                }
                Con.FIO        = model.FIO;
                Con.DataBirth  = model.DataBirth;
                Con.experience = model.experience;
                Con.Skill      = model.Skill;
                Con.Telephone  = model.Telephone;
                Con.City       = model.City;


                if (user.CountSummary == false)
                {
                    user.CountSummary = true;
                    Con.NameAutor     = user.Login;
                    condidateReposit.Add(Con);
                    userReposit.Update(user);
                }
                else
                {
                    condidateReposit.Update(Con);
                }
            }

            return(RedirectToAction("Index", "V1"));
        }