예제 #1
0
        public IHttpActionResult GetAllCategory()
        {
            var dtoOutput = _categoryBLL.GetAll();
            var response  = AutoMapper.Mapper.Map <GetAllCategoryResponse>(dtoOutput);

            return(Ok(response));
        }
예제 #2
0
 public IActionResult GetCategories()
 {
     try
     {
         return(Ok(GetCategories(categoryBLL.GetAll().Data)));
     }
     catch (Exception ex)
     {
         return(NotFound(ex));
     }
 }
        SubCategoryVM GetSubCategoryVM(SubCategory subCategory = null)
        {
            SubCategoryVM subCategoryVM = new SubCategoryVM();

            foreach (Category item in categoryBLL.GetAll().Data)
            {
                subCategoryVM.Categories.Add(new SelectListItem
                {
                    Text  = item.CategoryName,
                    Value = item.ID.ToString()
                });
            }
            if (subCategory != null)
            {
                subCategoryVM.SubCategoryName = subCategory.CategoryName;
                subCategoryVM.Overview        = subCategory.Description;
                subCategoryVM.CatID           = subCategory.CategoryID;
            }
            return(subCategoryVM);
        }