Beispiel #1
0
        public IEnumerable <ArticleImageInArticleModel> GetArticleImagesWithSameCheckSum(string simpleCheckSum)
        {
            SqlParameter[] parameters            = { new SqlParameter("@simpleCheckSum", simpleCheckSum) };
            DataSet        MatchingArticleImages = _sql.GetDatasetFromStoredProcedure("GetArticleImagesWithSameCheckSum", parameters);

            List <ArticleImageInArticleModel> images = new List <ArticleImageInArticleModel>();

            try
            {
                IEnumerable <DataRow> articleImageResults = MatchingArticleImages.Tables[0].AsEnumerable();

                foreach (var articleImageResult in articleImageResults)
                {
                    ArticleImageInArticleModel image = new ArticleImageInArticleModel(articleImageResult);
                    images.Add(image);
                }
            }
            catch (Exception ex)
            {
                string error = string.Format(
                    "There was an error checking for CheckSum {0} in ArticleImageService/GetArticleImagesWithSameCheckSum"
                    , simpleCheckSum);
                _logger.LogError(error, ex);
            }
            return(images.AsEnumerable());
        }
Beispiel #2
0
        public IEnumerable <ArticleImageInArticleModel> GetAllArticleImages()
        {
            DataSet articleImagesDataSet = _sql.GetDatasetFromStoredProcedure("GetAllArticleImages");

            List <ArticleImageInArticleModel> images = new List <ArticleImageInArticleModel>();

            try
            {
                IEnumerable <DataRow> articleImageResults = articleImagesDataSet.Tables[0].AsEnumerable();

                foreach (var articleImageResult in articleImageResults)
                {
                    ArticleImageInArticleModel image = new ArticleImageInArticleModel(articleImageResult);
                    images.Add(image);
                }
            }
            catch (Exception ex)
            {
                string error = string.Format(
                    "There was an error retrieving images in ArticleImageService/GetArticleImagesInArticles");
                _logger.LogError(error, ex);
            }
            return(images.AsEnumerable());
        }