コード例 #1
0
        /// <summary>
        /// The handle get.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// The <see cref="ResponseEnvelope"/>.
        /// </returns>
        public ResponseEnvelope <IEnumerable <TicketWM> > HandleGet(ITestApiContext context)
        {
            var results = _ticketService.GetAllTickets(context.AuthenticatedUser.Id.ToGuid()).ToList();

            var apiSearchResult = new ApiSearchResult <IEnumerable <Ticket> >(CreateRecordCounts(results.Count()), results);

            var ticketWMList = _responseBuilder.CreateDetails <Ticket, TicketWM>(context, ApiResourceEndPointForThisHandler, apiSearchResult);


            //   var ticketWMList = results.Select(ticket => _objectFactory.Create<TicketWM>(ticket));


            var recordCounts = CreateRecordCounts(ticketWMList.Count());

            var searchResults = new ApiSearchResult <IEnumerable <TicketWM> >(recordCounts, ticketWMList);

            return(_responseBuilder.CreateResponse(context, searchResults));
        }