public async Task <IActionResult> Create([Bind("Evenement_ID,MaxDeelnemers,Beschrijving,Startuur,Einduur,Datum,Prijs,IsZichtbaar")] Evenement evenement)
        {
            if (ModelState.IsValid)
            {
                _context.Add(evenement);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(evenement));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(CreateDrankkaartViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.Drankkaart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewModel));
        }
        public async Task <IActionResult> Create(CreateProductViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.Product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            viewModel.ProductTypes        = new SelectList(_context.productTypes, "ProductTypeID", "Naam", viewModel.Product.ProductTypeID);
            viewModel.Product.IsZichtbaar = true;
            viewModel.Product.StartDatum  = DateTime.Now;
            viewModel.Product.EindDatum   = default;
            return(RedirectToAction(nameof(IndexManager)));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create(CreateBestellingViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.Bestelling);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            //viewModel.Persoon = _context.Personen.Find(id);// hoe kan ik hier de ingelogde id vinden
            viewModel.Bestelling       = new Bestelling();
            viewModel.Bestelling.Datum = DateTime.Now.Date;
            viewModel.Productenlijst   = _context.Producten.Include(x => x.ProductType).ToList();
            return(View(viewModel));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create(CreatePersoonViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.Persoon);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            viewModel.Persoon = new Persoon()
            {
                AangemaaktDatum = DateTime.Now,
                IsActief        = true,
                IsAdmin         = false
            };
            return(View(viewModel));
        }