Ejemplo n.º 1
0
 public IActionResult CreateTickets(TicketModel ticketModel)
 {
     if (ModelState.IsValid)
     {
         try
         {
             TicketsModel Tickets = JsonConvert.DeserializeObject <TicketsModel>
                                        (_freshDeskApi.FreshDesk("tickets", JsonConvert.SerializeObject(ticketModel), "POST"));
             return(Ok(Tickets));
         }
         catch (WebException e)
         {
             return(BadRequest(_freshDeskApi.Exception(e)));
         }
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
 public IActionResult CreateNote(long ticket_id, NoteModel noteModel)
 {
     if (ModelState.IsValid && ticket_id != 0)
     {
         try
         {
             NotesModel notes = JsonConvert.DeserializeObject <NotesModel>
                                    (_freshDeskApi.FreshDesk($"tickets/{ticket_id}/notes", JsonConvert.SerializeObject(noteModel), "POST"));
             return(Ok(notes));
         }
         catch (WebException e)
         {
             return(BadRequest(_freshDeskApi.Exception(e)));
         }
     }
     else if (ticket_id == 0)
     {
         return(BadRequest("Enter Ticket Id"));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }