Esempio n. 1
0
        public IActionResult GetAll()
        {
            var result = _categoryService.GetAll();

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        private IResult CheckIfProductCategoryLimit()
        {
            var result = _catagoryService.GetAll();

            if (result.Data.Count > 15)
            {
                return(new ErrorResult(Messages.CategoryLimitExcededs));
            }
            return(new SuccessResult());
        }
Esempio n. 3
0
        public ActionResult Add()
        {
            List <SelectListItem> catagoryList = new List <SelectListItem>();

            foreach (Catagory catagory in catagoryService.GetAll())
            {
                catagoryList.Add(new SelectListItem()
                {
                    Text = catagory.CatagoryName, Value = catagory.Id.ToString()
                });
            }

            ViewBag.CatagoryList = catagoryList;

            return(View("AddProduct"));
        }