public IEnumerable <domain.Ticket> Execute() { return(ticketRepository.GetAllWithState(State).Select(ticket => { var ticketAttribution = ticketAttributionRepository.GetFromTicket(ticket.Id); if (ticketAttribution != null) { ticket.AttributedTo = userRepository.GetById(ticketAttribution.StaffId); } ticket.Comments = ticketCommentRepository.GetByTicketId(ticket.Id); return ticket; })); }
public IEnumerable <domain.Ticket> Execute() { var result = ticketRepository.GetAllByPaging(Page, Amount).Select(ticket => { var ticketAttribution = ticketAttributionRepository.GetFromTicket(ticket.Id); if (ticketAttribution != null) { ticket.AttributedTo = userRepository.GetById(ticketAttribution.StaffId); } ticket.Comments = ticketCommentRepository.GetByTicketId(ticket.Id); return(ticket); }); return(result); }
public domain.Ticket Execute() { var result = ticketRepository.GetById(Id); if (result == null) { return(null); } var ticketAttribution = ticketAttributionRepository.GetFromTicket(result.Id); if (ticketAttribution != null) { result.AttributedTo = userRepository.GetById(ticketAttribution.StaffId); } result.Comments = ticketCommentRepository.GetByTicketId(result.Id); return(result); }
public long Execute() { if (Input == null) { return(-1); } var attr = ticketAttributionRepository.GetFromTicket(Input.Id); if (attr?.StaffId != userId) { return(-1); } var ticket = new domain.Ticket(Input.Id, Input.OpenedById, Input.State, Input.Description, Input.PlaceId, Input.Title, Input.Created); return(ticketRepository.Update(ticket)); }
public bool Execute() { var comments = ticketCommentRepository.GetByTicketId(Id); comments.ForEach(comment => ticketCommentRepository.Delete(comment.Id)); var attr = ticketAttributionRepository.GetFromTicket(Id); if (attr != null) { ticketAttributionRepository.Delete(attr.Id); } var ware = ticketWareRepository.GetByTicketId(Id); if (ware != null) { ticketWareRepository.Delete(Id); } return(ticketRepository.Delete(Id)); }
public IEnumerable <domain.Ticket> Execute() { var user = userRepository.GetById(UserId); if (user == null) { throw new Exception("l'utilisateur n'existe pas"); } var res = ticketRepository.GetAllOpenedBy(UserId).Select(ticket => { var ticketAttribution = ticketAttributionRepository.GetFromTicket(ticket.Id); if (ticketAttribution != null) { ticket.AttributedTo = userRepository.GetById(ticketAttribution.StaffId); } ticket.Comments = ticketCommentRepository.GetByTicketId(ticket.Id); return(ticket); }); return(res); }