Exemplo n.º 1
0
        public ActionResult GetCategoriesWithEdit(Guid id)
        {
            CategoryWithEditVM result            = _categoryLogic.GetCategoriesWithEditAsync(id);
            ReqFilterCategory  reqFilterCategory = new ReqFilterCategory
            {
                PageSize    = 5,
                CurrentPage = 1
            };
            var result2 = _categoryLogic.FilterCategoryWithPagingAsync(reqFilterCategory);

            result.CategoryList = result2.Result;
            return(Ok(new BaseResponse(result)));
        }
Exemplo n.º 2
0
        /*
         * Get list all category with edit data
         */
        public CategoryWithEditVM GetCategoriesWithEditAsync(Guid id)
        {
            CategoryWithEditVM categoryWithEditVM = new CategoryWithEditVM();

            try
            {
                // categoryWithEditVM.CategoryList = _uow.GetRepository<Category>().GetAll();
                Category categoryData = _uow.GetRepository <Category>().GetWithRelated(a => a.Id == id, null, "Seo").FirstOrDefault();
                if (categoryData != null)
                {
                    categoryWithEditVM.Category = categoryData;
                }
                return(categoryWithEditVM);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message.ToString());
                throw ex;
            }
        }