Exemplo n.º 1
0
 public void EditTraining(TrainingViewModel model)
 {
     if (!ModelState.IsValid) {
         return;
     }
     var training = TrainingModel.ToDomainModel(model.Training);
     if (training.Id > 0) {
         masterService.UpdateTraining(training);
     } else {
         masterService.AddTraining(new[] { training });
         //Add New Training to TrainingProfileMap
         var manpowerIds =
             dealerManpowerService.GetAllDealerManpowers().Select(x => x.Id);
         var list = manpowerIds.Select(id => new TrainingProfileMap() { Id = 0, TrainingId = training.Id, DealerManpowerId = id }).ToList();
         trainingProfileMapService.AddTrainingProfileMap(list);
     }
 }
Exemplo n.º 2
0
 public ActionResult EditTraining(int id)
 {
     var model = new TrainingViewModel {
         Designations = Enumeration.GetAll<Designation>(),
         Training = id > 0 ? TrainingModel.FromDomainModel(masterService.GetTraining(id)) : new TrainingModel()
     };
     return PartialView("EditTraining", model);
 }