public ActionResult DeleteConfirmed(int id)
        {
            BILET bILET = db.BILETs.Find(id);

            db.BILETs.Remove(bILET);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void Buying(string metoda)
        {
            using (DatabasePZEntities db = new DatabasePZEntities())
            {
                GODZINY updateSpot = db.GODZINY.Where(h => h.Godzina == _selectedHour).FirstOrDefault(s => s.Id_Seansu == _seance.SeansID);
                char[]  spots      = updateSpot.Miejsca.ToCharArray();

                bool canBuying = _spots.Where(n => spots[n.SpotNumber - 1] == '0').Count() != 0;

                if (canBuying)
                {
                    foreach (var spot in _spots)
                    {
                        BILET ticket = new BILET()
                        {
                            Potwierdzenie = 0,
                            Imie          = _firstName,
                            Nazwisko      = _lastName,
                            Email         = _email,
                            Telefon       = _phoneNumber,
                            Id_Godziny    = updateSpot.Id_Godziny,
                            Id_ulga       = _selectedDiscount + 1,
                            Realizacja    = 0,
                            Miejsce       = spot.SpotNumber - 1
                        };
                        db.BILET.Add(ticket);
                        spot.IsAvailable           = 1;
                        spots[spot.SpotNumber - 1] = '1';
                    }
                    updateSpot.Miejsca = new string(spots);
                    db.SaveChanges();

                    // Tutaj bedzie przekierowanie do jakiegos api platnosci karta/gotowka


                    // tresc emaila
                    string trescEmaila = "Tutaj bedzie jakas tresc emaila";

                    SendEmail email = new SendEmail();
                    email.SendAsync(_email, "Rezerwacja filmu", trescEmaila);


                    MessageBox.Show("Bilet kupiony - " + metoda);
                    NavigationManager.BackToMain();
                }
                else
                {
                    {
                        foreach (var spot in _spots)
                        {
                            spot.IsAvailable = 1;
                        }
                        MessageBox.Show("Miejsca zostaly juz przez kogos zarezerwowane. Prosze wybrac inne");
                        NavigationManager.BackToMain();
                    }
                }
            }
        }
 public ActionResult Edit([Bind(Include = "id_bilet,cena,e_mail,vreme_na_rezervacija,id_proekcija,id_film,broj_sala,broj_sediste,broj_red")] BILET bILET)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bILET).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bILET));
 }
Пример #4
0
 public ActionResult EditTicket(BILET model)
 {
     if (ModelState.IsValid)
     {
         repository.UpdateTicket(model);
         repository.Save();
         return(RedirectToAction("Tickets"));
     }
     else
     {
         return(View(model));
     }
 }
Пример #5
0
 public ActionResult CreateTicket(BILET t)
 {
     if (ModelState.IsValid)
     {
         repository.AddTicket(t);
         repository.Save();
         return(RedirectToAction("Tickets"));
     }
     else
     {
         return(View(t));
     }
 }
        // GET: BILET/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BILET bILET = db.BILETs.Find(id);

            if (bILET == null)
            {
                return(HttpNotFound());
            }
            return(View(bILET));
        }
Пример #7
0
        public ActionResult TicketDetails(int id)
        {
            BILET t = repository.GetTicketById(id);

            return(View(t));
        }