working #24
@@ -5,8 +5,9 @@ import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { Company, Employee } from 'app/models/Company';
|
||||
import { Company } from 'app/models/Company';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { Employee } from 'app/models/Employee';
|
||||
|
||||
@Component({
|
||||
selector: 'main-company',
|
||||
@@ -20,6 +21,7 @@ export class CompanyComponent {
|
||||
public Employers: Employee[] = [];
|
||||
|
||||
public Comp: Company | null = null;
|
||||
public CompEmployees: Employee[] = [];
|
||||
public Desc: string[] = [];
|
||||
|
||||
public List: JobListing[] = [];
|
||||
@@ -39,7 +41,6 @@ export class CompanyComponent {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
changeSelectedCompany(companyID: number){
|
||||
@@ -61,6 +62,15 @@ export class CompanyComponent {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
|
||||
this.http.get<Employee[]>("api/employee/" + companyID).subscribe({
|
||||
next: data => {
|
||||
this.CompEmployees = data;
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RemoveJobListing( JobListingID: number ){
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { Company, Employee } from 'app/models/Company';
|
||||
|
||||
@Component({
|
||||
selector: 'main-jobs-editor',
|
||||
@@ -85,35 +84,20 @@ export class JobEditorComponent {
|
||||
this.updateUI();
|
||||
}
|
||||
|
||||
PostNewJob(jobListing: JobListing){
|
||||
jobListing.companyID = this.modeID;
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PostEditJob(jobListing: JobListing){
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SubmitForm(job: JobListing){
|
||||
SubmitForm(jobListing: JobListing){
|
||||
if (this.mode === "new"){
|
||||
this.PostNewJob(job);
|
||||
jobListing.companyID = this.modeID;
|
||||
} else if (this.mode === "edit"){
|
||||
this.PostEditJob(job);
|
||||
jobListing.id = this.modeID;
|
||||
}
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,15 +39,4 @@ export class JobsComponent {
|
||||
|
||||
};
|
||||
|
||||
RemoveJobListing( JobListingID: number ){
|
||||
this.http.delete("api/joblisting?JobListingID=" + JobListingID).subscribe({
|
||||
next: data => {
|
||||
window.location.reload();
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace BoredCareers.Controllers {
|
||||
|
||||
public AuthenticationController(DatabaseService db) : base(db) { }
|
||||
|
||||
[HttpPost("loginState")]
|
||||
[HttpPost("loginstate")]
|
||||
public ActionResult<Account> LoginState() {
|
||||
if (isLoggedIn()) {
|
||||
return Ok(getLoggedInUser());
|
||||
|
||||
@@ -35,8 +35,12 @@ namespace BoredCareers.Controllers {
|
||||
Company? test = await _databaseService.GetCompany(Convert.ToInt32(company.ID));
|
||||
if (test == null) {
|
||||
company.ID = await _databaseService.SetCompany(company);
|
||||
|
||||
|
||||
await _databaseService.SetEmployee(new Employee() {
|
||||
AccountID = getLoggedInUserID(),
|
||||
AccountName = getLoggedInUser().UserName,
|
||||
AccountEmail = getLoggedInUser().Email,
|
||||
Company = company
|
||||
});
|
||||
return Ok();
|
||||
@@ -66,7 +70,7 @@ namespace BoredCareers.Controllers {
|
||||
}
|
||||
|
||||
[HttpGet("sendverifyemail")]
|
||||
public async Task<ActionResult<string>> SendVerify([FromQuery] int CompanyID) {
|
||||
public async Task<ActionResult> SendVerify([FromQuery] int CompanyID) {
|
||||
try {
|
||||
string key = "v" + CompanyID;
|
||||
// Stop from sending multiple emails quickly
|
||||
@@ -99,7 +103,7 @@ namespace BoredCareers.Controllers {
|
||||
}
|
||||
|
||||
[HttpGet("verifyemail")]
|
||||
public async Task<ActionResult<bool>> VerifyEmail([FromQuery] int CompanyID, [FromQuery] string EmailToken) {
|
||||
public async Task<ActionResult> VerifyEmail([FromQuery] int CompanyID, [FromQuery] string EmailToken) {
|
||||
try {
|
||||
Company? test = await _databaseService.GetCompany(CompanyID);
|
||||
if (test != null) {
|
||||
|
||||
Reference in New Issue
Block a user