示例#1
0
 public IActionResult AddNote(Ticket ticket, string note)
 {
     if (ticket.TicketId != 0)
     {
         ticketRepository.CreateNote(note, ticket);
         return(RedirectToAction(nameof(Edit), new { ticketId = ticket.TicketId }));
     }
     else
     {
         ModelState.AddModelError("", "Please save the ticket before adding notes");
         return(View("Edit", ticket));
     }
 }
示例#2
0
        public ApiTicket Post(int id, [FromBody] string description) // Creates a new note on a ticket
        {
            var ticket = ticketRepository.Tickets.FirstOrDefault(t => t.TicketId == id);

            ticketRepository.CreateNote(description, ticket);
            return(new ApiTicket
            {
                TicketId = ticket.TicketId,
                AssignedUser = ticket.AssignedUser?.UserName,
                AssignedGroup = ticket.AssignedGroup?.Name,
                Title = ticket.Title,
                Description = ticket.Description,
                Notes = ticket.Notes,
                AssignmentStatus = ticket.AssignmentStatus,
                Opened = ticket.Opened,
                Closed = ticket.Closed,
                ParentID = ticket.Parent?.TicketId
            });
        }