Beispiel #1
0
        public IActionResult Create([Bind("TicketID,Description,ProjectID")] Ticket ticket)
        {
            ticket.SubmitterID = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;
            ticket.Status      = StatusType.Open;
            ticket.Priority    = PriorityType.Low;

            if (ModelState.IsValid)
            {
                ticketRepo.AddTicket(ticket);
                return(RedirectToAction(nameof(Index)));
            }

            ViewData["ProjectID"] = new SelectList(_context.Projects, "ProjectID", "ProjectName", ticket.ProjectID);
            return(View(ticket));
        }