Beispiel #1
0
        public IEnumerable <ReviewerEntity> GetAllReviewer(string reviewerName)
        {
            try
            {
                var reviewerTable = TableStore.Instance.GetTable(TableStore.ReviewerTableName) as ReviewerTable;
                var allReviewer   = reviewerTable.GetAllItems <ReviewerEntity>();

                foreach (ReviewerEntity re in allReviewer.Values)
                {
                    var filePattern = re.ReviewerName.Replace(" ", "-").ToLower();

                    var file = new BlobStorageService().GetSinglFile(BlobStorageService.Blob_ImageContainer, filePattern);

                    if (!string.IsNullOrEmpty(file))
                    {
                        re.ReviewerImage = file.Substring(file.LastIndexOf("/") + 1);
                    }
                    else
                    {
                        re.ReviewerImage = "default-movie.jpg";
                    }
                }

                //Return only those artists who have associated posters.
                //Associated poster means those artists are popular. Hence they have associated posters
                if (string.IsNullOrEmpty(reviewerName))
                {
                    return(allReviewer.Values.OrderBy(a => a.ReviewerName));
                }
                else
                {
                    return(allReviewer.Values.Where(a => a.ReviewerName.ToLower().Trim().Contains(reviewerName)));
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                return(null);
            }
        }