Esempio n. 1
0
        public HttpResponseMessage PrintCartWithList(Guid cartId, ListType listType, long listId, PrintListModel options)
        {
            HttpResponseMessage ret;

            try
            { //TODO: Unravel this cartreport list...
                Stream stream = _shoppingCartLogic.CartReport
                                    (AuthenticatedUser,
                                    SelectedUserContext,
                                    cartId,
                                    _listService.ReadPagedList(AuthenticatedUser, SelectedUserContext, listType, listId, PagingHelper.BuildPagingFilter(options)
                                                               .Paging),
                                    options);

                HttpResponseMessage result = Request.CreateResponse(HttpStatusCode.OK);
                result.Content = new StreamContent(stream);
                result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
                result.Content.Headers.ContentType        = new System.Net.Http.Headers.MediaTypeHeaderValue("application/pdf");

                ret = result;
            }
            catch (Exception ex)
            {
                _log.WriteErrorLog("List Export", ex);
                ret = Request.CreateResponse(HttpStatusCode.InternalServerError);
            }
            return(ret);
        }