Browse Source

JobViewModel

confirmation-email
J 11 years ago
parent
commit
77e8e8966f
4 changed files with 74 additions and 4 deletions
  1. +2
    -1
      Sevomin.Models/Job.cs
  2. +56
    -0
      Sevomin.Models/JobViewModel.cs
  3. +1
    -0
      Sevomin.Models/Sevomin.Models.csproj
  4. +15
    -3
      Sevomin.WebFrontend.Controllers/JobController.cs

+ 2
- 1
Sevomin.Models/Job.cs View File

@ -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; }


+ 56
- 0
Sevomin.Models/JobViewModel.cs View File

@ -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<JobParameterViewModel> 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<JobParameterViewModel>();
foreach (var jp in job.JobParameters)
{
Parameters.Add(new JobParameterViewModel(jp));
}
}
}
}

+ 1
- 0
Sevomin.Models/Sevomin.Models.csproj View File

@ -68,6 +68,7 @@
<Compile Include="Job.cs" />
<Compile Include="JobParameter.cs" />
<Compile Include="JobParameterViewModel.cs" />
<Compile Include="JobViewModel.cs" />
<Compile Include="LoginViewModel.cs" />
<Compile Include="Migrations\201403261205298_InitialCreate.cs" />
<Compile Include="Migrations\201403261205298_InitialCreate.Designer.cs">


+ 15
- 3
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -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);
}
}
}

Loading…
Cancel
Save