public void UpdateSeanceTimes(SeanceViewModel seanceVM) { if (seanceVM.Validate(this)) { Seance seance = repository.GetSeance(seanceVM.SeanceID); seance.HeureDebut = seanceVM.HeureDebut; seance.HeureFin = seanceVM.HeureFin; } else { throw new ScheduleException(); } }
// Validation et création d'une séance. public SeanceViewModel CreateSeance(SeanceViewModel seanceVM) { if (seanceVM.Validate(this)) { Seance seance = mapper.Map <SeanceViewModel, Seance>(seanceVM); try { repository.CreateSeance(seance); } catch (Exception ex) { throw new DBException(ex); } return(mapper.Map <Seance, SeanceViewModel>(seance)); } else { throw new ScheduleException(); } }