예제 #1
0
 public ActionResult Create(Guid spectacleId)
 {
     var spectacle = mSpectacleService.GetById(spectacleId);
     if (spectacle == null) return HttpNotFound();
     SeanceDTO dto = new SeanceDTO(true){SpectacleId = spectacleId, SpectacleName = spectacle.Name};
     return View(dto);
 }
예제 #2
0
 public ActionResult Create(SeanceDTO seance)
 {
     if (ModelState.IsValid)
     {
         mSeanceService.Add(seance);
         return RedirectToAction("Seances", "Spectacle", new { id = seance.SpectacleId });
     }
     return View(seance);
 }
예제 #3
0
 public ActionResult EditConfirm(SeanceDTO seance)
 {
     if (ModelState.IsValid)
     {
         mNotificationService.NotificateOnUpdate(seance.Id, seance.Date);
         mSeanceService.Update(seance);
         return RedirectToAction("Seances", "Spectacle", new {id = seance.SpectacleId});
     }
     return View(seance);
 }
예제 #4
0
        public void RemoveSeance(SeanceDTO seance)
        {
            var seanceDb = mDb.Seances.Get(seance.Id);
            if (seanceDb == null) return;

            NotificateUsersOnSeanceDelete(seanceDb);

            mDb.Seances.Delete(seance.Id);
            mDb.SaveChanges();
        }
예제 #5
0
        public void AddSeance(SeanceDTO seance)
        {
            var spectacle = mDb.Spectacles.Get(seance.SpectacleId);
            if (spectacle == null) return;

            var newSeance = seance.Convert();

            newSeance.Id = Guid.NewGuid();
            spectacle.Seances.Add(newSeance);
            mDb.SaveChanges();
        }
예제 #6
0
        public void ChangeSeance(SeanceDTO seance)
        {
            var dbEntitiy = mDb.Seances.Get(seance.Id);
            if (dbEntitiy == null) return;

            var changed = seance.Convert();

            NotificateUsersOnSeanceChanging(dbEntitiy, changed.Date);

            mDb.Seances.Update(changed);
            mDb.SaveChanges();
        }
예제 #7
0
 public void Add(SeanceDTO seance)
 {
     mContext.Seances.Add(seance.Convert());
     mContext.SaveChanges();
 }
예제 #8
0
 public void Update(SeanceDTO seance)
 {
     mContext.Seances.Update(seance.Convert());
     mContext.SaveChanges();
 }