コード例 #1
0
        //
        // GET: /Scores/Details
        public ViewResult Details(string sourceId)
        {
            //use mindtouch dream to access the web service.
            // treat the result and return it to the view
            FoireMusesConnection connection = GetConnection();
            Source source = null;
            IList <SourcePageSearchItem> pages         = null;
            IEnumerable <string>         attachedFiles = null;
            IEnumerable <string>         documents     = null;

            try
            {
                source = connection.GetSource(sourceId, new Result <Source>()).Wait();

                if (source.HasAttachement)
                {
                    attachedFiles = source.GetAttachmentNames().Where(x => !x.StartsWith("$"));
                    documents     = source.GetAttachmentNames().Where(x => x.StartsWith("$"));
                }

                pages = connection.GetSourcePagesFromSource(source.Id, 0, 0, new Result <SearchResult <SourcePageSearchItem> >()).Wait().Rows;
            }
            catch (Exception e)
            {
                // do stuff to return error message to the screen
            }
            ViewBag.AttachedFiles = attachedFiles;
            ViewBag.Documents     = documents;
            ViewBag.Pages         = pages;
            return(View(source));
        }