Пример #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();
 }