Beispiel #1
0
        public async Task <IActionResult> VideoCate(int?page = 1, int?pageSize = 8)
        {
            //Get Menu
            ViewBag.MenuMachine = await _repoWrapper.ProductCategory.GetLstMenuByParentId(654);

            ViewBag.MenuMaterials = await _repoWrapper.ProductCategory.GetLstMenuByParentId(652);

            ViewBag.MenuServices = await _repoWrapper.ProductCategory.GetLstMenuByParentId(651);

            ViewBag.MenuHeader = await _repoWrapper.Video.GetLstVideoCate();

            ViewBag.MetaTags = await _repoWrapper.Setting.GetSetting();

            var url = RouteData.Values["url"];
            LibraryCategoryDTO result = await _repoWrapper.Library.LibraryCategoryByUrl((string)url);

            if (result != null)
            {
                ViewBag.CateVideoId     = result.LibraryCategory_ID;
                ViewBag.UrlVideoCate    = url;
                ViewBag.CatName         = result.Name;
                ViewBag.ListVideoByCate = await _repoWrapper.Article.GetVideoByCate(result.LibraryCategory_ID, 2, (int)page, (int)pageSize);

                ViewBag.Page     = page ?? 1;
                ViewBag.PageSize = pageSize ?? 8;
                if (ViewBag.ListVideoByCate.Count > 0)
                {
                    ViewBag.TotalCount = ViewBag.ListVideoByCate[0]?.TotalCount;
                    ViewBag.TotalPages = (int)Math.Ceiling(decimal.Divide(ViewBag.TotalCount, pageSize ?? 8));
                }
            }
            return(View());
        }
Beispiel #2
0
        public async Task <IActionResult> LibraryCate()
        {
            //Get Menu
            ViewBag.MenuMachine = await _repoWrapper.ProductCategory.GetLstMenuByParentId(654);

            ViewBag.MenuMaterials = await _repoWrapper.ProductCategory.GetLstMenuByParentId(652);

            ViewBag.MenuServices = await _repoWrapper.ProductCategory.GetLstMenuByParentId(651);

            ViewBag.MenuHeader = await _repoWrapper.Video.GetLstVideoCate();

            ViewBag.MetaTags = await _repoWrapper.Setting.GetSetting();

            var url = RouteData.Values["url"];

            LibraryCategoryDTO result = await _repoWrapper.Library.LibraryCategoryByUrl((string)url);

            if (result != null)
            {
                ViewBag.ListLibByCate = await _repoWrapper.Library.GetLstLibByCate(result.LibraryCategory_ID, 1, 28);

                ViewBag.CateUrl  = result.URL;
                ViewBag.CateName = result.Name;
                ViewBag.CateId   = result.LibraryCategory_ID;
            }

            return(View());
        }
Beispiel #3
0
 public LibraryViewModel()
 {
     lstLib1   = new List <Library_Search_By_Cate_Result>();
     lstLib2   = new List <Library_Search_By_Cate_Result>();
     lstLib3   = new List <Library_Search_By_Cate_Result>();
     CateName1 = new LibraryCategoryDTO();
     CateName2 = new LibraryCategoryDTO();
     CateName3 = new LibraryCategoryDTO();
 }
Beispiel #4
0
        public async Task <LibraryCategoryDTO> LibraryCategoryById(int Id)
        {
            LibraryCategoryDTO output       = new LibraryCategoryDTO();
            string             apiUrl       = $"/api/v1/LibraryCategory/GetLibraryCategoryById";
            string             paramRequest = $"?LibraryCategoryId={Id}";
            var response = await _client.GetAsync(apiUrl + paramRequest);

            if (response.IsSuccessStatusCode)
            {
                string responseStream = await response.Content.ReadAsStringAsync();

                output = JsonConvert.DeserializeObject <LibraryCategoryDTO>(responseStream);
            }
            return(output);
        }
        public async Task <LibraryCategoryDTO> GetLibraryCategoryByUrl(string Url)
        {
            var output = new LibraryCategoryDTO();

            try
            {
                var result = await _repoWrapper.LibraryCategory.GetLibCategoryByUrl(Url);

                output = _mapper.Map <LibraryCategoryDTO>(result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"GetLibraryCategoryByUrl: " + ex.ToString());
            }
            return(output);
        }