public async Task <IActionResult> Create([Bind("Id,Name,Address,Phone")] Cinema cinema)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cinema);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cinema));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] Hall hall)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hall);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hall));
        }
        public async Task <IActionResult> Create([Bind("Id,price,Discount")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticket));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Id,Title,Release_date,Adult,Description,Origin,Poster_path")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
        public async Task <IActionResult> Create([Bind("Id,Date,Language,Subtitles")] Performance performance)
        {
            if (ModelState.IsValid)
            {
                performance.Hall  = _context.Halls.Where(S => S.Name.Equals("halltest")).FirstOrDefault();
                performance.Movie = _context.Movies.Where(S => S.Title.Equals("batman")).FirstOrDefault();
                _context.Add(performance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(performance));
        }
Esempio n. 6
0
        // GET: Seats
        public async Task <IActionResult> Index()
        {
            Performance performance = _context.Performances.Where(S => S.Movie.Id == 1).First();

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    Seat seat = new Seat();
                    seat.XPosition   = i;
                    seat.YPosition   = j;
                    seat.Performance = performance;
                    _context.Add(seat);
                }
            }
            await _context.SaveChangesAsync();

            return(View(await _context.Seats.ToListAsync()));
        }
Esempio n. 7
0
        public async Task <IActionResult> PaymentForm()
        {
            var         collection  = Request.Form;
            BookingForm bookingForm = new BookingForm();

            bookingForm.checkboxes          = collection["checkedItems"];
            bookingForm.Name                = collection["firstName"];
            bookingForm.CardNumber          = collection["cardNumber"];
            bookingForm.CardExpirationYear  = Int16.Parse(collection["expYear"]);
            bookingForm.CardExpirationMonth = Int16.Parse(collection["expMonth"]);
            bookingForm.Cvs = collection["cvs"];
            PaymentService.PaymentClient paymentClient = new PaymentService.PaymentClient();
            Task <bool> isValid = paymentClient.ValidateCardAsync(new PaymentService.Card
            {
                CardExpirationMonth = bookingForm.CardExpirationMonth,
                CardExpirationYear  = bookingForm.CardExpirationYear,
                CardNumber          = bookingForm.CardNumber,
                Name = bookingForm.Name,
                Cvs  = bookingForm.Cvs
            });

            //tuto je vysledok z toho
            bool correctPayment = isValid.Result;

            foreach (String item in bookingForm.checkboxes)
            {
                _context.Seats.Where(S => S.XPosition == Int16.Parse("" + item[0]) &&
                                     S.YPosition == Int16.Parse("" + item[2])).First().Payment = new Payment();

                // seat.Payment = new Payment();

                //_context.Seats.Update(seat);
            }
            _context.SaveChangesAsync();
            bookingForm.PaymentCheck = correctPayment;
            //ServiceReference1.Service1Client paymentService = new ServiceReference1.Service1Client();*/
            return(View(bookingForm));
        }