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)); }
public ActionResult FindVacancy() { List <Vacancy> LVacancy = new List <Vacancy>(); List <WorkModel> LWorkModel = new List <WorkModel>(); VacancyReposit vacanceReposit = new VacancyReposit(); LVacancy = vacanceReposit.GetVacancy(User.Identity.Name); foreach (var item in LVacancy) { WorkModel model = new WorkModel(); model.modelVacancy.Id = item.Id; model.modelVacancy.Name = item.Name; model.modelVacancy.Description = item.Description; model.modelVacancy.Time = item.Time; model.modelVacancy.CompanyName = item.CompanyName; model.modelVacancy.Request = item.Request; model.modelVacancy.Pay = item.Pay; model.modelVacancy.NameAutor = item.NameAutor; model.modelVacancy.OpenVacancy = item.OpenVacancy; LWorkModel.Add(model); } if (LVacancy.Count == 0) { ModelState.AddModelError("", "Вакансий не найдено"); } return(View(LWorkModel)); }