diff --git a/Sevomin.Models/Job.cs b/Sevomin.Models/Job.cs index 9a2df7f..8b9584b 100644 --- a/Sevomin.Models/Job.cs +++ b/Sevomin.Models/Job.cs @@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; +using Sevomin.Models.Helpers; namespace Sevomin.Models { @@ -25,7 +26,7 @@ namespace Sevomin.Models public byte ResumeType { get; set; } public string ContactPersonName { get; set; } public string ContactPersonPhone { get; set; } - [EmailAddress] + [EmailValidation] public string ContactPersonEMail { get; set; } public bool ShowCompanyName { get; set; } diff --git a/Sevomin.Models/JobViewModel.cs b/Sevomin.Models/JobViewModel.cs new file mode 100644 index 0000000..ac9f31b --- /dev/null +++ b/Sevomin.Models/JobViewModel.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Sevomin.Models.Helpers; + +namespace Sevomin.Models +{ + public class JobViewModel + { + [Key] + public long Id { get; set; } + + [Required] + [StringLength(128)] + public string AvalinId { get; set; } + + public DateTime ExpireDate { get; set; } + + public string Description { get; set; } + public byte ResumeType { get; set; } + public string ContactPersonName { get; set; } + public string ContactPersonPhone { get; set; } + [EmailValidation] + public string ContactPersonEMail { get; set; } + + public bool ShowCompanyName { get; set; } + public bool ShowCompanyLogo { get; set; } + public bool IsFullTime { get; set; } + + public IList Parameters; + + public JobViewModel(Job job) + { + this.Id = job.Id; + this.AvalinId = job.AvalinId; + this.ExpireDate = job.ExpireDate; + this.Description = job.Description; + this.ResumeType = job.ResumeType; + this.ContactPersonEMail = job.ContactPersonEMail; + this.ContactPersonName = job.ContactPersonName; + this.ContactPersonPhone = job.ContactPersonPhone; + this.ShowCompanyLogo = job.ShowCompanyLogo; + this.ShowCompanyName = job.ShowCompanyName; + this.IsFullTime = job.IsFullTime; + + Parameters = new List(); + foreach (var jp in job.JobParameters) + { + Parameters.Add(new JobParameterViewModel(jp)); + } + } + } +} diff --git a/Sevomin.Models/Sevomin.Models.csproj b/Sevomin.Models/Sevomin.Models.csproj index 76ed9b5..07abf52 100644 --- a/Sevomin.Models/Sevomin.Models.csproj +++ b/Sevomin.Models/Sevomin.Models.csproj @@ -68,6 +68,7 @@ + diff --git a/Sevomin.WebFrontend.Controllers/JobController.cs b/Sevomin.WebFrontend.Controllers/JobController.cs index 67158b0..effa675 100644 --- a/Sevomin.WebFrontend.Controllers/JobController.cs +++ b/Sevomin.WebFrontend.Controllers/JobController.cs @@ -11,12 +11,24 @@ namespace Sevomin.WebFrontend.Controllers { public class JobController : AuthorizedController { + IJobRepository _JobRepository; + + public JobController() + { + _JobRepository = JobRepository.Current; + } + + public JobController(IJobRepository jobRepository) + { + _JobRepository = jobRepository; + } public ActionResult NewJob() { - Avalin avalin = null; - return View(/*JobRepository.Current.GetEmptyJobFor(avalin)*/); + Avalin avalin = (Avalin)User; //???? + Job job = _JobRepository.GetEmptyJobFor(avalin); + JobViewModel jvm = new JobViewModel(job); + return View(jvm); } - } }