Exemplo n.º 1
0
        public async Task <IActionResult> ArticleCate()
        {
            //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.Article.GetLstArticleCate();

            ViewBag.ListCategory = await _repoWrapper.Service.GetProdCateByParentID(651);

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

            ArticleCategoryDTO result = await _repoWrapper.Article.ArticleCategoryByUrl((string)url);

            if (result != null)
            {
                ViewBag.CateName      = result.Name;
                ViewBag.CateUrl       = result.URL;
                ViewBag.CateId        = result.ArticleCategory_ID;
                ViewBag.ListArtByCate = await _repoWrapper.Article.GetArtByCate(result.ArticleCategory_ID, 1, 1, 28);
            }

            return(View());
        }
Exemplo n.º 2
0
        public async Task CreateArticleCategoryAsync(ArticleCategoryDTO category)
        {
            var entity =
                _mapper.Map <ArticleCategoryDTO, ArticleCategoryEntity>(category);

            entity.Title = category.Title;

            await _repo.Create(entity);
        }
Exemplo n.º 3
0
        public async Task <ArticleCategoryDTO> ArticleCategoryByUrl(string url)
        {
            ArticleCategoryDTO output       = new ArticleCategoryDTO();
            string             apiUrl       = $"/api/v1/ArticleCategory/GetArticleCategoryByUrl";
            string             paramRequest = $"?Url={url}";
            var response = await _client.GetAsync(apiUrl + paramRequest);

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

                output = JsonConvert.DeserializeObject <ArticleCategoryDTO>(responseStream);
            }
            return(output);
        }
Exemplo n.º 4
0
        public async Task <ArticleCategoryDTO> GetArticleCategoryByUrl(string Url)
        {
            var output = new ArticleCategoryDTO();

            try
            {
                var result = await _repoWrapper.ArticleCategory.GetArtCategoryByUrl(Url);

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