private static void PrepareTicketList(List <Ticket> tickets) { using (var ctx = new SolutionsContext()) { var resources = ctx.Resources.ToList(); var statuses = ctx.Statuses.ToList(); var operations = ctx.Operations.ToList(); } foreach (var ticket in tickets) { ticket.Author = Employee.GetEmployee(ticket.AuthorId); ticket.Priority = Priority.ById(ticket.PriorityId); ticket.Operation = Operation.ById(ticket.OperationId); ticket.Resource = Resource.ById(ticket.OperationId); ticket.Status = Status.ById(ticket.StatusId); if (ticket.TesterId != null) { ticket.Tester = Employee.GetEmployee(ticket.TesterId); } if (ticket.ApproverId != null) { ticket.Approver = Employee.GetEmployee(ticket.ApproverId); } if (ticket.PerformerId != null) { ticket.Performer = Employee.GetEmployee(ticket.PerformerId); } ticket.ApproverComments = Comment.ByType(ticket.Id, (int)Enums.CommentTypes.Approve); ticket.PerformerComments = Comment.ByType(ticket.Id, (int)Enums.CommentTypes.Perform); } }