コード例 #1
0
        //[EnableCors("*")]
        public CarouselSuccessModel GetImages(string root, int skip, int take, bool includeLandscape, bool includePortrait)
        {
            var carouselInfo = new CarouselSuccessModel();

            try
            {
                using (var db = new OggleMySqlDbContext())
                {
                    if (includeLandscape)
                    {
                        carouselInfo.Links.AddRange(db.VwCarouselItems.Where(v => v.RootFolder == root).Where(v => v.Height < v.Width)
                                                    .Where(v => v.Width > v.Height)
                                                    .OrderBy(v => v.LinkId).Skip(skip).Take(take).ToList());
                    }
                    if (includePortrait)
                    {
                        carouselInfo.Links.AddRange(db.VwCarouselItems.Where(v => v.RootFolder == root).Where(v => v.Height < v.Width)
                                                    .Where(v => v.Height >= v.Width)
                                                    .OrderBy(v => v.LinkId).Skip(skip).Take(take).ToList());
                    }
                }
                carouselInfo.Success = "ok";
            }
            catch (Exception ex)
            {
                carouselInfo.Success = Helpers.ErrorDetails(ex);
            }
            return(carouselInfo);
        }
コード例 #2
0
        //[Route("Local/MySqlTest/{id}")]
        public TestResults MySqlTest(int parent)
        {
            var testResults = new TestResults();

            using (var db = new OggleMySqlDbContext())
            {
                List <CategoryFolder> categoryFolders = db.CategoryFolders.Where(f => f.Parent == parent).ToList();
                foreach (var categoryFolder in categoryFolders)
                {
                    testResults.Items.Add(new TestResultsItem()
                    {
                        Id = categoryFolder.Id, FolderName = categoryFolder.FolderName
                    });
                }
                testResults.Success = "ok";
            }
            return(testResults);
        }