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(); }
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); }
public IActionResult EditTicket(TicketJsonModel ticket) { _ticketRepository.EditTicket(ticket); return(RedirectToAction("Index")); }
public IActionResult Create(TicketJsonModel ticket) { _ticketRepository.NewTicket(ticket); return(RedirectToAction("Dashboard", "Home")); }