// POST: /Manage/CreateJob
        public ActionResult CreateJob(CreateJobViewModel model)
        {
            CreateJobVMValidator validator = new CreateJobVMValidator();
            ValidationResult result = validator.Validate(model);

            //Traitement
            var db = new ApplicationDbContext();
            if (result.IsValid)
            {
                var JobDb = db.Jobs;

                var newJob = new Job { JobName = model.Name, JobDesc = model.Description, CategoryId = model.SelectedCategory };
                //Ajout à la bdd
                JobDb.Add(newJob);
                //Commit!
                db.SaveChanges();

                return RedirectToAction("ListJobs", "Manage");
            }

            foreach (ValidationFailure failer in result.Errors)
            {
                ModelState.AddModelError(failer.PropertyName, failer.ErrorMessage);
            }
            //Redirection vers la liste des périodes pour l'utilisateur concerné
            model.Categories = db.Categories.ToList();
            return View(model);
        }
 // GET: /Manage/CreateJob
 public ActionResult CreateJob()
 {
     var db = new ApplicationDbContext();
     var vm = new CreateJobViewModel()
     {
         Categories = db.Categories.ToList(),
     };
     return View(vm);
 }