//obtener tickets completos public CompleteTicket[] getCompleteTickets() { List <CompleteTicket> tickets = new List <CompleteTicket>(); using (var db = new ToDoListContext()) { var query = from t in db.TICKET join rel in db.REL_TICKET_HAS_STATUS on t.id equals rel.id_ticket join stat in db.STATUS on rel.id_status equals stat.id select t; foreach (var item in query) { CompleteTicket complete = new CompleteTicket(); complete.Id = item.id; complete.Title = item.title; complete.Description = item.description; complete.Date = item.date; complete.EstimatedTime = item.estimated_time; complete.BoardID = item.board_id; complete.StatusName = item.REL_TICKET_HAS_STATUS.First().STATUS.name; complete.ColorStatus = item.REL_TICKET_HAS_STATUS.First().STATUS.color; tickets.Add(complete); } return(tickets.ToArray()); } }
//editar ticket public void updateTicket(CompleteTicket newTicket) { using (var db = new ToDoListContext()) { var ticket = db.TICKET.Where(t => t.id == newTicket.Id).First(); ticket.description = newTicket.Description; db.SaveChanges(); } }
//modificar ticket //put: api/ticket/{id} public void putTicket(int id, CompleteTicket ticket) { dataTickets.updateTicket(ticket); }