Beispiel #1
0
        public IActionResult Details(int id)
        {
            Ticket ticket = _gebruikerRepository.GetByTicketNr(id);

            if (ticket == null)
            {
                return(NotFound());
            }

            return(View(ticket));
        }
        public async Task <IActionResult> OnPostUploadAsync(Klant klant, int?id)
        {
            if (id == null)
            {
                return(RedirectToPage("/Index"));
            }
            // Perform an initial check to catch FileUpload class
            // attribute violations.
            if (!ModelState.IsValid)
            {
                Result = "Gelieve het formulier te corrigeren.";

                return(Page());
            }

            foreach (var formFile in FileUpload.FormFiles)
            {
                var formFileContent =
                    await FileHelpers.ProcessFormFile <BufferedMultipleFileUploadDb>(
                        formFile, ModelState, _permittedExtensions,
                        _fileSizeLimit);

                // Perform a second check to catch ProcessFormFile method
                // violations. If any validation check fails, return to the
                // page.
                if (!ModelState.IsValid)
                {
                    Result = "Gelieve het formulier te corrigeren.";

                    return(Page());
                }

                // **WARNING!**
                // In the following example, the file is saved without
                // scanning the file's contents. In most production
                // scenarios, an anti-virus/anti-malware scanner API
                // is used on the file before making the file available
                // for download or for use by other systems.
                // For more information, see the topic that accompanies
                // this sample.

                var file = new AppFile()
                {
                    Content       = formFileContent,
                    UntrustedName = formFile.FileName,
                    Note          = FileUpload.Note,
                    Size          = formFile.Length,
                    UploadDT      = DateTime.UtcNow,
                    ticket        = _gebruikerRepository.GetByTicketNr(id.Value)
                };
                _context.File.Add(file);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public IActionResult Index(int id)
        {
            Ticket  ticket  = _gebruikerRepository.GetByTicketNr(id);
            Rapport rapport = new Rapport
            {
                RapportNaam  = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                Beschrijving = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut mi in nisi posuere varius. In pharetra, risus a sagittis pharetra, lacus massa viverra turpis,  ",
                Ticket       = ticket,
                Oplossing    = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut mi in nisi posuere varius. In pharetra, risus a sagittis pharetra, lacus massa viverra turpis, sit amet rutrum magna augue at neque. Mauris commodo, dui eu varius tempus, elit elit lobortis tellus, ac aliquam mi diam vel ante. Etiam ac tortor vel orci laoreet viverra. Nulla lobortis commodo massa, et porta augue sodales nec. Cras sollicitudin ipsum in ante mattis, id lacinia magna dictum. Donec ut ligula et risus tempus interdum fringilla non nisl. Vestibulum non pellentesque tellus, id sagittis ex. Sed commodo semper turpis et luctus. Donec in ipsum vel nulla finibus venenatis quis ac quam. Integer sit amet dui massa. In ac ipsum consequat neque vehicula malesuada. Vestibulum in nunc risus. Morbi sodales iaculis augue aliquam volutpat. In non egestas tortor. Integer interdum congue lorem quis dictum."
            };

            _notyf.Information($"Raadpleeg hier het rapport van {ticket.Titel}");
            ViewBag.ticketnaam = ticket.Titel;
            return(View(rapport));
        }