Example #1
0
 // PUT api/values/5
 public void Put(Ticket ticket)
 {
     var tick = Uow.Tickets.GetByGuid(ticket.id);
     tick.airline = ticket.airline;
     tick.origin = ticket.origin;
     tick.destination = ticket.destination;
     tick.price = ticket.price;
     tick.disabled = ticket.disabled;
     Uow.Tickets.Update(tick);
     Uow.Commit();
     var context = GlobalHost.ConnectionManager.GetHubContext<TicketBoardHub>();
     context.Clients.All.updateTicket(tick);
 }
Example #2
0
        public HttpResponseMessage Post(Ticket ticket)
        {
            var newTicket = new Ticket(ticket.airline,
                ticket.origin, ticket.destination, ticket.price);
            Uow.Tickets.Add(newTicket);
            Uow.Commit();

            var response = Request.CreateResponse<Ticket>(HttpStatusCode.Created, newTicket);
            var uri = Url.Link("DefaultApi", new { id = newTicket.id });
            response.Headers.Location = new Uri(uri);

            var context = GlobalHost.ConnectionManager.GetHubContext<TicketBoardHub>();
            context.Clients.All.addNewTicket(newTicket);
            return response;
        }
Example #3
0
 public void UpdateTicket(Ticket ticket)
 {
     Clients.All.updateTicket(ticket);
 }
Example #4
0
 public void AddNewTicket(Ticket ticket)
 {
     Clients.All.addNewTicket(ticket);
 }