мелкие правки
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
|
||||
{
|
||||
APIClient.PostRequest($"api/resume/delete", new ResumeBindingModel { Id = id });
|
||||
return Redirect("~/User/UserProfile");
|
||||
return Redirect($"~/User/UserProfile/{APIClient.User?.Id}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -70,9 +70,18 @@ namespace CandidateReviewClientApp.Controllers
|
||||
if (model.Id != 0)
|
||||
{
|
||||
APIClient.PostRequest("api/user/update", model);
|
||||
if (model.Role == CandidateReviewDataModels.Enums.RoleEnum.Сотрудник)
|
||||
{
|
||||
return Redirect($"~/Company/CompanyProfile/{model.CompanyId}");
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (APIClient.Company != null)
|
||||
{
|
||||
|
@ -169,32 +169,48 @@ namespace CandidateReviewClientApp.Controllers
|
||||
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
if (APIClient.Company == null)
|
||||
{
|
||||
throw new Exception("Компания не определена");
|
||||
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 View(new List<VacancyViewModel?>());
|
||||
return RedirectToAction("Error", new { errorMessage = $"{ex.Message}", returnUrl });
|
||||
}
|
||||
|
||||
var results = APIClient.GetRequest<List<VacancyViewModel?>>($"api/vacancy/search?tags={tags}");
|
||||
return View(results);
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
|
@ -55,7 +55,7 @@
|
||||
@if (Model.Vacancies != null && Model.Vacancies.Any())
|
||||
{
|
||||
<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">
|
||||
<tr>
|
||||
<th>Название вакансии</th>
|
||||
@ -118,7 +118,7 @@
|
||||
{
|
||||
|
||||
<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">
|
||||
<tr>
|
||||
<th>Фамилия</th>
|
||||
|
@ -20,6 +20,13 @@ namespace CandidateReviewDatabaseImplement.Implements
|
||||
|
||||
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.SaveChanges();
|
||||
|
||||
|
@ -19,6 +19,21 @@ namespace CandidateReviewDatabaseImplement.Implements
|
||||
|
||||
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.SaveChanges();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user