Exemplo n.º 1
0
        // If a user wants to partake in the survey
        public ViewResult Survey(string error)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }
            TempData["model"] = model;

            if (error != null)
            {
                ViewBag.SurveyError = error;
            }

            return(View("Survey", model));
        }
Exemplo n.º 2
0
        // Show cash register employee login screen
        public ViewResult CashRegisterEmployeeLogin(string error)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.Errorlogincash = error;
            }

            TempData["model"] = model;
            return(View("CashRegisterEmployeeLogin", model));
        }
Exemplo n.º 3
0
        // Show SubscriptionHolder login page
        public ViewResult Login(string error)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.error = error;
            }

            TempData["model"] = model;
            return(View("Login", model));
        }
Exemplo n.º 4
0
        public ActionResult Create(CinemaViewModel model)
        {
            var cinema = new Cinema();

            if (model == null)
            {
                return(View());
            }

            if (ModelState.IsValid)
            {
                cinema.CinemaName         = model.CinemaName;
                cinema.CinemaAddress      = model.CinemaAddress;
                cinema.CinemaManager      = model.CinemaManager;
                cinema.CinemaPhone        = model.CinemaPhone;
                cinema.CinemaSeatCapacity = model.CinemaSeatCapacity;


                _context.Cinemas.Add(cinema);
                _context.Entry(cinema).State = EntityState.Added;
                _context.SaveChanges();
                ModelState.Clear();
            }
            var result   = new RowSeat();
            var rows     = model.CinemaSeatCapacity / 10;
            var cinemaId = _context.Cinemas.FirstOrDefault(x => x.CinemaName.Equals(model.CinemaName)).Id;

            for (var i = 0; i < rows; i++)
            {
                result.RowNumber = i + 1;
                result.CinemaId  = cinemaId;

                for (var j = 0; j < 10; j++)
                {
                    result.SeatNumber = j + 1;

                    _context.RowSeats.Add(result);
                    _context.Entry(result).State = EntityState.Added;
                    _context.SaveChanges();
                }
            }


            return(View());
        }
Exemplo n.º 5
0
        public ActionResult CheckValue()
        {
            string valuestring = Request["value"];

            decimal value = decimal.Parse(valuestring);

            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("GiftCardPayment", "Payment",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            decimal price = model.GetTotalPriceForAllTickets();

            if (value > price)
            {
                decimal remainingvalue = new PaymentLogic().RemainingValue(value, price);

                if (remainingvalue > 5)
                {
                    ViewBag.todo = "Het resterende bedrag op de bon is €" + remainingvalue + ". Gelieve dit bedrag op de bon te noteren voor toekomstig gebruik.";
                }
                else
                {
                    ViewBag.todo = "Het resterende bedrag op de bon is €" + remainingvalue + ". Gelieve dit bedrag contant terug te geven en de bon weg te gooien.";
                }
            }

            else
            {
                decimal remainingprice = new PaymentLogic().RemainingPrice(value, price);

                ViewBag.todo = "Het resterende bedrag na inlevering van de bon is €" + remainingprice + ". Gelieve dit bedrag contant af te handelen.";
            }

            TempData["model"] = model;
            return(View("GiftCardPayment", model));
        }
Exemplo n.º 6
0
        // GET: Cinemas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cinema cinema = db.Cinemas.Find(id);

            if (cinema == null)
            {
                return(HttpNotFound());
            }
            CinemaViewModel c = mapper.Map <Cinema, CinemaViewModel>(cinema);

            ViewBag.ResponsableID = new SelectList(db.Responsables, "ResponsableID", "Nom", cinema.ResponsableID);
            ViewBag.Programmateur = new SelectList(db.Users.Where(u => u.Type == UserTypes.prog), "Login", "NomComplet", cinema.Programmateur);
            return(View(c));
        }
Exemplo n.º 7
0
        private void InsertNewTicketsIntoDatabase(CinemaViewModel model)
        {
            var context  = new EFDbContext();
            var customer = context.Customers.ToList()[0];

            model.GetSeatsList().ForEach(s => context.Seats.Add(s));
            context.SaveChanges();

            var tickets = model.GetTicketsList(context.Seats.ToList(), customer);

            foreach (Ticket t in tickets)
            {
                context.Tickets.Add(t);
                context.SaveChanges();
            }
            TempData["InsertedTickets"] = tickets;
            context.SaveChanges();
        }
Exemplo n.º 8
0
        // GET: Cinemas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cinema cinema = db.Cinema.Find(id);

            if (cinema == null)
            {
                return(HttpNotFound());
            }

            CinemaViewModel cinemaViewModel = ConvertCinemaToViewModel(cinema);

            ViewBag.MovieFormatId = new SelectList(db.MovieFormat, "MovieFormatId", "Name",
                                                   cinemaViewModel.MovieFormatId);
            return(View(cinemaViewModel));
        }
Exemplo n.º 9
0
        public ViewResult INGPayment(string error)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.Errorpayment = error;
            }

            model.isPaid = true;

            TempData["model"] = model;
            return(View("INGPayment", model));
        }
Exemplo n.º 10
0
        /**
         *  Lost and found functionalities
         */
        public ActionResult ManageLostAndFound()
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("CashRegisterEmployeeLogin", "Login",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            TempData["model"] = model;

            return(View("ManageLostAndFound", model));
        }
Exemplo n.º 11
0
        public ActionResult Delete(int id)
        {
            var model  = new CinemaViewModel();
            var result = _context.Cinemas.FirstOrDefault(x => x.Id.Equals(id));

            if (result == null)
            {
                return(HttpNotFound());
            }

            model.Id                 = result.Id;
            model.CinemaName         = result.CinemaName;
            model.CinemaAddress      = result.CinemaAddress;
            model.CinemaManager      = result.CinemaManager;
            model.CinemaPhone        = result.CinemaPhone;
            model.CinemaSeatCapacity = result.CinemaSeatCapacity;

            return(View(model));
        }
Exemplo n.º 12
0
        public ActionResult searchFilm()
        {
            CinemaViewModel model          = (CinemaViewModel)TempData["model"];
            FilmVerifier    searchVerifier = new FilmVerifier();
            string          inputString    = Request["searchFilm"];
            Film            searchResult   = searchVerifier.verify(inputString, repo.getFilmList());

            if (searchResult != null)
            {
                SetModelStuff(model, searchResult);
                TempData["model"] = model;

                //andere controller aanroepen
                return(RedirectToAction("renderFilm", new { filmID = searchResult.FilmID }));
            }
            else
            {
                return(RedirectToAction("renderFilm", new { filmID = -1 }));
            }
        }
Exemplo n.º 13
0
        public void GetAllCinemas()
        {
            CinemaViewModel cinema = new CinemaViewModel()
            {
                CinemaName           = "My testing cinema",
                CinemaDescription    = "My testing cinema description",
                CinemaProfilePicture = "Test picture url",
                AdminUserId          = "d3956f65-2089-470c-b0d9-a15832c8bdab",
                AdressId             = 2,
                SeatsRows            = 10,
                SeatColumns          = 20,
                CreatedByUserId      = "d3956f65-2089-470c-b0d9-a15832c8bdab",
                LastModifiedByUserId = "d3956f65-2089-470c-b0d9-a15832c8bdab",
                CreatedOnDate        = DateTime.Now.ToString("dd/MM/yyyy"),
                LastModifiedOnDate   = DateTime.Now.ToString("dd/MM/yyyy"),
                IsDeleted            = false
            };

            Assert.True(_cinemaService.AddCinema(cinema));
        }
Exemplo n.º 14
0
        public static void UpdateCinema(this Cinema cinema, CinemaViewModel cinemaViewModel)
        {
            cinema.CinemaID = cinemaViewModel.CinemaID;

            cinema.CinemaPrefix    = cinemaViewModel.CinemaPrefix;
            cinema.CinemaFullName  = cinemaViewModel.CinemaFullName;
            cinema.CinemaAddress   = cinemaViewModel.CinemaAddress;
            cinema.CinemaPhone     = cinemaViewModel.CinemaPhone;
            cinema.CinemaEmail     = cinemaViewModel.CinemaEmail;
            cinema.CinemaManagerID = cinemaViewModel.CinemaManagerID;
            cinema.CinemaStatus    = cinemaViewModel.CinemaStatus;
            cinema.CinemaCode      = cinemaViewModel.CinemaCode;

            cinema.CreatedDate     = cinemaViewModel.CreatedDate;
            cinema.CreatedBy       = cinemaViewModel.CreatedBy;
            cinema.UpdatedDate     = cinemaViewModel.UpdatedDate;
            cinema.UpdatedBy       = cinemaViewModel.UpdatedBy;
            cinema.MetaKeyword     = cinemaViewModel.MetaKeyword;
            cinema.MetaDescription = cinemaViewModel.MetaDescription;
        }
Exemplo n.º 15
0
        public ActionResult Edit(int?id)
        {
            CinemaViewModel cinemaViewModel = null;

            if (id != null)
            {
                Cinema cinema = _cinemaService.Find((int)id);
                cinema.CinemaID = (int)id;
                cinemaViewModel = Mapper.Map <Cinema, CinemaViewModel>(cinema);
            }

            if (cinemaViewModel != null)
            {
                ViewBag.CinemaManagerID = new SelectList(_staffService.GetAll(), "StaffID", "StaffCode", cinemaViewModel.CinemaManagerID);
                ViewBag.CinemaStatus    = new SelectList(_statusService.GetAll(), "StatusID", "StatusName", cinemaViewModel.CinemaStatus);
                return(View(cinemaViewModel));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 16
0
        public ActionResult SetLocationAndReturn(String locationName)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (locationName != null && model != null)
            {
                model.SelectedLocation = model.findLocationByName(locationName);
            }
            else if (model == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                model.SelectedLocation = model.findLocationByName("Breda");
            }

            TempData["model"] = model;
            return(RedirectToAction("Contact", "Contact"));
        }
Exemplo n.º 17
0
        public ActionResult Edit(CinemaViewModel model)
        {
            if (ModelState.IsValid)
            {
                var cinema = _context.Cinemas.AsNoTracking().FirstOrDefault(x => x.Id == model.Id);
                if (cinema != null)
                {
                    cinema.CinemaName         = model.CinemaName;
                    cinema.CinemaAddress      = model.CinemaAddress;
                    cinema.CinemaManager      = model.CinemaManager;
                    cinema.CinemaPhone        = model.CinemaPhone;
                    cinema.CinemaSeatCapacity = model.CinemaSeatCapacity;

                    _context.Cinemas.Attach(cinema);
                    _context.Entry(cinema).State = EntityState.Modified;
                    _context.SaveChanges();
                    ModelState.Clear();
                }
            }

            return(View(model));
        }
Exemplo n.º 18
0
        public ActionResult EditInfo(string error, string confirmation)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.error = error;
            }

            if (confirmation != null)
            {
                ViewBag.confirmation = confirmation;
            }

            TempData["model"] = model;
            return(View("EditInfo", model));
        }
Exemplo n.º 19
0
        public ActionResult SendMails(/*HttpPostedFileBase file*/)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInBackOffice != true)
            {
                return(RedirectToAction("BackOfficeLogin", "Login", new { error = "Log in om deze pagina te bezoeken" }));
            }

            string subject  = Request["subject"];
            string mailtext = Request["text"];

            List <NewsletterRegistration> emails = repo.GetRegistrations().ToList();

            int resultscount = emails.Count();

            // Check if there is any emails to send the newsletter to, before starting to set it up
            if (resultscount == 0)
            {
                TempData["model"] = model;
                return(RedirectToAction("Mail", "Mail", new { error = "Er zijn geen nieuwsbriefaanmeldingen." }));
            }

            //var fileName = Path.GetFileName(file.FileName);
            //var path = Path.Combine(Server.MapPath("~/MailAttachments"), fileName);
            //file.SaveAs(path);


            new Mailer().SendMail(emails, mailtext, subject /*, path*/);

            TempData["model"] = model;
            return(RedirectToAction("Mail", "Mail", new { confirmation = "Mails succesvol verzonden." }));
        }
Exemplo n.º 20
0
        public ActionResult NewHolder(string error, string confirmation)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.AddError = error;
            }

            if (confirmation != null)
            {
                ViewBag.AddConfirmation = confirmation;
            }

            TempData["model"] = model;

            return(View("NewHolder", model));
        }
Exemplo n.º 21
0
        public ViewResult AfterPayCode()
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            InsertNewTicketsIntoDatabase(model);

            // empty seat coord list
            model.SeatCoordList.Clear();

            List <Ticket> InsertedTickets = ((List <Ticket>)TempData["InsertedTickets"]);

            Ticket t = InsertedTickets[0];

            if (t != null)
            {
                ViewBag.keycode = t.SecretKey;
            }


            TempData["model"]           = model;
            TempData["InsertedTickets"] = InsertedTickets;
            return(View("ShowCodeView"));
        }
Exemplo n.º 22
0
        public ActionResult Create(CinemaViewModel cinemaViewModel)
        {
            if (ModelState.IsValid)
            {
                Cinema cinema = new Cinema();
                cinemaViewModel.CreatedDate = DateTime.Now;
                cinema.UpdateCinema(cinemaViewModel);

                if (cinema != null)
                {
                    _cinemaService.Add(cinema);
                    _cinemaService.SaveChanges();

                    //Redirect To Index Action
                    //SetAlert("Thêm rạp chiếu phim thành công!", CommonConstrants.SUCCESS_ALERT);
                    return(RedirectToAction("Index"));
                }
            }
            //Action/Controller
            ViewBag.CinemaStatus = new SelectList(_statusService.GetAll(), "StatusID", "StatusName");
            //ViewBag.StaffId = new SelectList(_staffService.GetAll(), "StaffID", "StaffCode");
            return(View(cinemaViewModel));
        }
Exemplo n.º 23
0
        public ActionResult Create([Bind(Include = "Id,Image,Name,Address,PhoneNumber")] CinemaViewModel cinemaViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(cinemaViewModel));
            }
            string extension = Path.GetExtension((cinemaViewModel.Image.FileName));

            if (extension == null)
            {
                return(RedirectToAction("Index"));
            }
            string virtualPath  = FormVirtualPath(extension);
            string physicalPath = HttpContext.Server.MapPath(virtualPath);

            cinemaViewModel.ImagePath = virtualPath;

            CinemaDomainModel cinemaDomainModel = Mapper.Map <CinemaViewModel, CinemaDomainModel>(cinemaViewModel);

            _cinemaService.Add(cinemaDomainModel);
            cinemaViewModel.Image.SaveAs(physicalPath);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 24
0
        public ActionResult AddHolder()
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            // Retrieve the input
            string email   = Request["email"];
            string address = Request["address"];
            string city    = Request["city"];

            // Check if the required fields have been filled in
            if (email == "" || address == "" || city == "")
            {
                return(RedirectToAction("NewHolder", "SubscriptionHolder",
                                        new { error = "Vul a.u.b. alle verplichte velden in" }));
            }

            var context = new EFDbContext();

            var newholder = new SubscriptionHolder()
            {
                Email   = email,
                Address = address,
                City    = city
            };

            context.SubscriptionHolders.Add(newholder);
            context.SaveChanges();


            return(RedirectToAction("NewHolder", "SubscriptionHolder",
                                    new { confirmation = "Uw gegevens zijn succesvol toegevoegd" }));
        }
Exemplo n.º 25
0
        public ActionResult FindLostAndFound(string error, string confirmation)
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (error != null)
            {
                ViewBag.FindError = error;
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("CashRegisterEmployeeLogin", "Login",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            TempData["model"] = model;

            return(View("FindLostAndFound", model));
        }
Exemplo n.º 26
0
        public Task <CinemaViewModel> GetCinemaById(int id)
        {
            var cinema = _cinemaRepository.GetCinemaById(id);

            CinemaViewModel myCinema = new CinemaViewModel()
            {
                CinemaId             = cinema.CinemaId,
                AdminUserId          = cinema.AdminUserId,
                CinemaName           = cinema.CinemaName,
                CinemaDescription    = cinema.CinemaDescription,
                AdressId             = cinema.AdressId,
                CreatedByUserId      = cinema.CreatedByUserId,
                LastModifiedByUserId = cinema.LastModifiedByUserId,
                CreatedOnDate        = cinema.CreatedOnDate,
                LastModifiedOnDate   = cinema.LastModifiedOnDate,
                AdminUser            = cinema.AdminUser,
                Adress             = cinema.Adress,
                CreatedByUser      = cinema.CreatedByUser,
                LastModifiedByUser = cinema.LastModifiedByUser,
                IsDeleted          = false
            };

            return(Task.Run(() => myCinema));
        }
Exemplo n.º 27
0
        // GET: Ticket
        public ActionResult ShowTicketView()
        {
            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            // Request input from Credit Card Payment
            string cardNumber     = Request["cardnumber"];
            string name           = Request["name"];
            string date           = Request["date"];
            string securityNumber = Request["securitynumber"];

            //Request input from ING Bank Payment
            string username = Request["username"];
            string password = Request["password"];

            if (cardNumber != null && name != null && date != null && securityNumber != null)
            {
                if (cardNumber == "" || name == "" || date == "" || securityNumber == "")
                {
                    ViewBag.Errorpayment = "Vul a.u.b. alle velden in.";

                    return(RedirectToAction("MasterCardPayment", "Payment", new { error = "Vul a.u.b. alle velden in." }));
                }
                else
                {
                    InsertNewTicketsIntoDatabase(model);

                    // empty seat coord list
                    model.SeatCoordList.Clear();
                    TempData["model"] = model;
                    return(View("ShowTicketView"));
                }
            }

            if (username != null && password != null)
            {
                if (username == "" || password == "")
                {
                    ViewBag.Errorpayment = "Vul a.u.b. alle velden in.";

                    return(RedirectToAction("INGPayment", "Payment", new { error = "Vul a.u.b. beide velden in." }));
                }
                else
                {
                    InsertNewTicketsIntoDatabase(model);

                    // empty seat coord list
                    model.SeatCoordList.Clear();
                    TempData["model"] = model;
                    return(View("ShowTicketView"));
                }
            }

            /* if (model.PinValue != null)
             * {
             *  if (model.PinValue == "")
             *  {
             *      return View("ShowTicketView");
             *  }
             *
             *  if (model.PinValue == "0000")
             *  {
             *      model.WrongPingValue = "Vul een geldige pincode in";
             *
             *
             *      TempData["model"] = model;
             *      return RedirectToAction("PinView", "Pin");
             *  }
             *  else
             *  {
             *      InsertNewTicketsIntoDatabase(model);
             *
             *      // empty seat coord list
             *      model.SeatCoordList.Clear();
             *      TempData["model"] = model;
             *      return View("ShowTicketView");
             *  }
             * } */
            else
            {
                InsertNewTicketsIntoDatabase(model);

                // empty seat coord list
                model.SeatCoordList.Clear();
                TempData["model"] = model;
                return(View("ShowTicketView"));
            }
        }
Exemplo n.º 28
0
        public ActionResult TenRideCardCheck()
        {
            string valuestring = Request["code"];

            int code;

            int.TryParse(valuestring, out code);

            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("TenRideCardPayment", "Payment",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            List <TenRidesCard> cards = TenRideRepo.GetCards().ToList();

            // Check the remaining rides on the card
            TenRidesCard foundCard = new PaymentLogic().FindCard(code, cards);

            if (foundCard == null)
            {
                return(RedirectToAction("TenRideCardPayment", "Payment", new { error = "Er kon geen kaart gevonden worden met deze code" }));
            }

            int rides        = foundCard.Rides;
            int totalTickets = model.GetAllTicketsQuantity();

            if (rides > totalTickets)
            {
                int remaingRides = rides - totalTickets;

                var context         = new EFDbContext();
                var CardToBeChanged = context.TenRidesCards.SingleOrDefault(c => c.CardCode == code);
                CardToBeChanged.Rides = remaingRides;
                context.SaveChanges();

                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "Betaling succesvol, de kaart heeft nog " + remaingRides + " ritten beschikbaar." }));
            }

            if (rides == totalTickets)
            {
                var context = new EFDbContext();
                context.TenRidesCards.Remove(foundCard);
                context.SaveChanges();

                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "Betaling succesvol, het aantal ritten op deze kaart zijn nu verbruikt." }));
            }

            else
            {
                var context = new EFDbContext();
                context.TenRidesCards.Remove(foundCard);
                context.SaveChanges();

                int remainingTickets = totalTickets - rides;
                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "De kaart is volledig verbruikt (" + rides + " ritten). Er dienen nog " + remainingTickets + " kaartjes afgerekend te worden." }));
            }
        }
Exemplo n.º 29
0
        public ActionResult WeekDayCardCheck()
        {
            string codestring = Request["code"];

            int code = int.Parse(codestring);

            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("WeekDayCard", "Payment",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            if (code != 0)
            {
                // Check if current day is monday/tuesday/wednesday/thursday
                string today = DateTime.Now.DayOfWeek.ToString();

                if (today == "Monday" || today == "Tuesday" || today == "Wednesday" || today == "Thursday")
                {
                    // Check if it's not currently an holiday
                    bool a = model.IsHoliday(DateTime.Now);

                    if (a != true)
                    {
                        List <WeekDayCard> cards     = WeekDayRepo.GetCards().ToList();
                        WeekDayCard        foundCard = cards.Where(c => c.Code == code).ToList()[0];

                        if (foundCard == null)
                        {
                            return(RedirectToAction("WeekDayCard", "Payment",
                                                    new { error = "Er kon geen kaart gevonden worden met deze code" }));
                        }

                        var context = new EFDbContext();
                        context.WeekDayCards.Remove(foundCard);
                        context.SaveChanges();

                        int totalcards     = model.GetAllTicketsQuantity();
                        int remainingcards = totalcards - 1;

                        if (remainingcards != 0)
                        {
                            return(RedirectToAction("WeekDayCard", "Payment",
                                                    new
                            {
                                confirmation =
                                    "De kaart is succesvol gebruikt. Er dienen nog " + remainingcards +
                                    " kaartjes afgerekend te worden."
                            }));
                        }
                        else
                        {
                            return(RedirectToAction("WeekDayCard", "Payment",
                                                    new { confirmation = "Kaart succesvol gebruikt." }));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("WeekDayCard", "Payment",
                                                new { error = "Het is momenteel vakantie, dit soort tickets is nu niet geldig." }));
                    }
                }
                else
                {
                    return(RedirectToAction("WeekDayCard", "Payment",
                                            new { error = "Het is momenteel geen van de geldige dagen voor dit soort kaart." }));
                }
            }

            else
            {
                return(RedirectToAction("WeekDayCard", "Payment", new { error = "Vul a.u.b. een correcte code in. (5 cijfers)" }));
            }
        }
Exemplo n.º 30
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new CinemaViewModel();
        }