Ejemplo n.º 1
0
        public async Task <User> Add(User User)
        {
            _context.Add(User); //Change Tracker : only change the state
            await _context.SaveChangesAsync();

            return(User);
        }
Ejemplo n.º 2
0
        public async Task <Ticket> Add(Ticket Ticket)
        {
            _context.Add(Ticket); //Change Tracker : only change the state
            await _context.SaveChangesAsync();

            return(Ticket);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,EmailAdres,Voornaam,Tussenvoegsels,Achternaam,Telefoonnummer")] Klant klant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(klant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(klant));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ID,Ticket,ReleaseDate,Deadline,Urgency,Assigned,Completed")] Tickets tickets)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tickets);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tickets));
        }
        public IActionResult Create([FromBody] TicketItem ticket)
        {
            if (ticket == null)
            {
                return(BadRequest());
            }
            _context.Add(ticket);
            _context.SaveChanges();

            return(CreatedAtRoute("GetTicket", new { id = ticket.Id }, ticket));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Id,Volgorde,Naam")] Status status)
        {
            if (ModelState.IsValid)
            {
                _context.Add(status);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(status));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("Id,Naam,BeheerderId")] Applicatie applicatie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicatie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BeheerderId"] = new SelectList(_context.Medewerkers, "Id", "Achternaam", applicatie.BeheerderId);
            return(View(applicatie));
        }
        public Person Create(Person person)
        {
            try
            {
                _ticketContext.Add(person);
                _ticketContext.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(person);
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Create([Bind("Id,KlantId,ApplicatieId,Onderwerp,Omschrijving")] Ticket ticket)
        {
            Status status = _context.Statussen.OrderBy(s => s.Volgorde).FirstOrDefault();

            ticket.StatusId = status.Id;

            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicatieId"] = new SelectList(_context.Applicaties, "Id", "Naam", ticket.ApplicatieId);
            ViewData["KlantId"]      = new SelectList(_context.Klanten, "Id", "Achternaam", ticket.KlantId);
            return(View(ticket));
        }
        public void CreateOrder()
        {
            var optionsBuilder = new DbContextOptionsBuilder <TicketContext>();

            using (TicketContext context = new TicketContext(optionsBuilder.Options))
            {
                var order = new TicketRecord()
                {
                    Name      = Parking.Name,
                    VehicleID = Parking.VehicleID,
                    StartTime = Parking.StartTime,
                    EndTime   = Parking.Endtime,
                    OccupationTimeInMinutes = OccupationTime,
                    AmountToPay             = TicketCost,
                    ParkingSpot             = new Random().Next(1, 30),
                };

                context.Add(order);
                context.SaveChanges();
            }
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Create([Bind("TicketId,Title,Description,CreatedByUser,TicketStatus")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                var ticketRoleName = "Ticket #" + ticket.TicketId;

                IdentityRole identityRole = new IdentityRole
                {
                    Name = ticketRoleName
                };

                await roleManager.CreateAsync(identityRole);

                var user = await userManager.FindByNameAsync(ticket.CreatedByUser);

                await userManager.AddToRoleAsync(user, ticketRoleName);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticket));
        }