мелкие правки
This commit is contained in:
parent
ce45f973f5
commit
3963f8f102
@ -1,9 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,7 +0,0 @@
|
|||||||
namespace CandidateReviewBusiness
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -207,7 +207,7 @@ namespace CandidateReviewClientApp.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
APIClient.PostRequest($"api/resume/delete", new ResumeBindingModel { Id = id });
|
APIClient.PostRequest($"api/resume/delete", new ResumeBindingModel { Id = id });
|
||||||
return Redirect("~/User/UserProfile");
|
return Redirect($"~/User/UserProfile/{APIClient.User?.Id}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -70,9 +70,18 @@ namespace CandidateReviewClientApp.Controllers
|
|||||||
if (model.Id != 0)
|
if (model.Id != 0)
|
||||||
{
|
{
|
||||||
APIClient.PostRequest("api/user/update", model);
|
APIClient.PostRequest("api/user/update", model);
|
||||||
|
if (model.Role == CandidateReviewDataModels.Enums.RoleEnum.Сотрудник)
|
||||||
|
{
|
||||||
|
return Redirect($"~/Company/CompanyProfile/{model.CompanyId}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var existingUser = APIClient.GetRequest<UserViewModel?>($"api/user/login?login={model.Email}&password={model.Password}");
|
||||||
|
if (existingUser != null)
|
||||||
|
{
|
||||||
|
throw new Exception("Такой пользователь уже существует");
|
||||||
|
}
|
||||||
APIClient.PostRequest("api/user/register", model);
|
APIClient.PostRequest("api/user/register", model);
|
||||||
if (APIClient.Company != null)
|
if (APIClient.Company != null)
|
||||||
{
|
{
|
||||||
|
@ -169,32 +169,48 @@ namespace CandidateReviewClientApp.Controllers
|
|||||||
|
|
||||||
public IActionResult Delete(int id)
|
public IActionResult Delete(int id)
|
||||||
{
|
{
|
||||||
if (APIClient.Company == null)
|
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||||
{
|
try
|
||||||
throw new Exception("Компания не определена");
|
{
|
||||||
|
if (APIClient.Company == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Компания не определена");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest($"api/vacancy/delete", new VacancyBindingModel { Id = id });
|
||||||
|
APIClient.Company = APIClient.GetRequest<CompanyViewModel?>($"api/company/profile?id={APIClient.User?.CompanyId}");
|
||||||
|
|
||||||
|
return Redirect("~/Company/CompanyProfile");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Error", new { errorMessage = $"{ex.Message}", returnUrl });
|
||||||
}
|
}
|
||||||
|
|
||||||
APIClient.PostRequest($"api/vacancy/delete", new VacancyBindingModel { Id = id });
|
|
||||||
APIClient.Company = APIClient.GetRequest<CompanyViewModel?>($"api/company/profile?id={APIClient.User?.CompanyId}");
|
|
||||||
|
|
||||||
return Redirect("~/Company/CompanyProfile");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult SearchVacancies(string? tags)
|
public IActionResult SearchVacancies(string? tags)
|
||||||
{
|
{
|
||||||
if (APIClient.User == null)
|
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
throw new Exception("Доступно только авторизованным пользователям");
|
if (APIClient.User == null)
|
||||||
}
|
{
|
||||||
|
throw new Exception("Доступно только авторизованным пользователям");
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(tags))
|
if (string.IsNullOrEmpty(tags))
|
||||||
|
{
|
||||||
|
ViewBag.Message = "Пожалуйста, введите поисковый запрос.";
|
||||||
|
return View(new List<VacancyViewModel?>());
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = APIClient.GetRequest<List<VacancyViewModel?>>($"api/vacancy/search?tags={tags}");
|
||||||
|
return View(results);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ViewBag.Message = "Пожалуйста, введите поисковый запрос.";
|
return RedirectToAction("Error", new { errorMessage = $"{ex.Message}", returnUrl });
|
||||||
return View(new List<VacancyViewModel?>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = APIClient.GetRequest<List<VacancyViewModel?>>($"api/vacancy/search?tags={tags}");
|
|
||||||
return View(results);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
@if (Model.Vacancies != null && Model.Vacancies.Any())
|
@if (Model.Vacancies != null && Model.Vacancies.Any())
|
||||||
{
|
{
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover align-middle">
|
<table class="table table-striped table-hover align-middle" id="vacancies">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название вакансии</th>
|
<th>Название вакансии</th>
|
||||||
@ -118,7 +118,7 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover align-middle">
|
<table class="table table-striped table-hover align-middle" id="employees">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Фамилия</th>
|
<th>Фамилия</th>
|
||||||
|
@ -20,6 +20,13 @@ namespace CandidateReviewDatabaseImplement.Implements
|
|||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
|
var assessmentsToRemove = context.Assessments
|
||||||
|
.Where(a => a.ResumeId == element.Id)
|
||||||
|
.ToList();
|
||||||
|
if (assessmentsToRemove.Any())
|
||||||
|
{
|
||||||
|
context.Assessments.RemoveRange(assessmentsToRemove);
|
||||||
|
}
|
||||||
context.Resumes.Remove(element);
|
context.Resumes.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
|
@ -19,6 +19,21 @@ namespace CandidateReviewDatabaseImplement.Implements
|
|||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
|
var resumesToRemove = context.Resumes.Where(a => a.VacancyId == element.Id).ToList();
|
||||||
|
if (resumesToRemove.Any())
|
||||||
|
{
|
||||||
|
foreach (var resume in resumesToRemove)
|
||||||
|
{
|
||||||
|
var assessmentsToRemove = context.Assessments
|
||||||
|
.Where(a => a.ResumeId == resume.Id)
|
||||||
|
.ToList();
|
||||||
|
if (assessmentsToRemove.Any())
|
||||||
|
{
|
||||||
|
context.Assessments.RemoveRange(assessmentsToRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.Resumes.RemoveRange(resumesToRemove);
|
||||||
|
}
|
||||||
context.Vacancies.Remove(element);
|
context.Vacancies.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user