Example #1
0
        public async void NewTicket(TicketJsonModel ticket)
        {
            var values = JsonConvert.SerializeObject(ticket);

            var httpContent  = new StringContent(values, Encoding.UTF8, "application/json");
            var httpResponse = await Client.PostAsync("https://localhost:44342/api/Ticket", httpContent);

            var responseContent = await httpResponse.Content.ReadAsStringAsync();
        }
Example #2
0
        public void EditTicket(TicketJsonModel ticket)
        {
            var client = new RestClient("https://localhost:44342/api/Ticket/" + ticket.TicketId);

            client.Timeout = -1;
            var request = new RestRequest(Method.PATCH);

            request.AddHeader("Content-Type", "application/json");
            request.AddParameter("application/json", JsonConvert.SerializeObject(ticket), ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

            Console.WriteLine(response.Content);
        }
Example #3
0
 public IActionResult EditTicket(TicketJsonModel ticket)
 {
     _ticketRepository.EditTicket(ticket);
     return(RedirectToAction("Index"));
 }
Example #4
0
        public IActionResult Create(TicketJsonModel ticket)
        {
            _ticketRepository.NewTicket(ticket);

            return(RedirectToAction("Dashboard", "Home"));
        }