Exemplo n.º 1
0
        public IEnumerable <SelectListItem> GetCategories()
        {
            var categories = _categoryLogic.GetAll().ToList().
                             Select(s => new SelectListItem
            {
                Text  = s.Name,
                Value = s.Id.ToString()
            }).ToList();

            return(categories);
        }
Exemplo n.º 2
0
		public IActionResult Index()
		{
			var categories = _categoryLogic.GetAll();
			var products = _productLogic.GetAll();

			var model = new ShopViewModel
			{
				Categories = categories,
				Products = products
			};

			return View(model);
		}
Exemplo n.º 3
0
        public CategoryModule(ICategoryLogic categoryLogic) : base("/category")
        {
            this._categoryLogic = categoryLogic;

            Get["/getallcategory"] = _ => //GetAllCategories();
            {
                try
                {
                    var json = new
                    {
                        Code = "0000",
                        Data = _categoryLogic.GetAll()
                    };

                    return(Response.AsText(JsonConvert.SerializeObject(json), "application/json;charset=UTF-8"));
                }
                catch (Exception ex)
                {
                    return(Response.AsText(JsonConvert.SerializeObject(new ResponseModel()
                    {
                        Code = "0009", Msg = ex.Message
                    }), "application/json;charset=UTF-8"));
                }
            };
        }
Exemplo n.º 4
0
        public IActionResult Index()
        {
            CategoryViewModel model = new CategoryViewModel
            {
                Categories = new List <CategoryModel>(),
                Tree       = _categoryLogic.GetCategoryTree()
            };

            var categories = _categoryLogic.GetAll();

            foreach (var category in categories)
            {
                model.Categories.Add(_mapper.GetCategoryModel(category));
            }

            return(View(model));
        }
Exemplo n.º 5
0
 public async Task <AdminPanel> GetPanel()
 {
     return(new AdminPanel
     {
         Projects = (await _projectLogic.GetAll()).ToList(),
         Comments = (await _commentLogic.GetAll()).ToList(),
         Categories = (await _categoryLogic.GetAll()).ToList()
     });
 }
 public IActionResult GetAll()
 {
     try
     {
         return(Ok(_categoryLogic.GetAll()));
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// get all categories
        /// </summary>
        /// <returns></returns>
        private dynamic GetAllCategories()
        {
            var json = new
            {
                Code = "0000",
                Msg  = "success",
                Row  = _cateLogic.GetAll()
            };

            return(Response.AsText(JsonConvert.SerializeObject(json), "application/json; charset =UTF-8"));
        }
Exemplo n.º 8
0
        public List <SelectListItem> GetCategories()
        {
            var categories = _categoryLogic.GetAll().
                             Select(s => new SelectListItem
            {
                Text  = s.Name,
                Value = s.Id.ToString()
            }).ToList();

            categories.Add(new SelectListItem {
                Value = "0", Text = "Любая", Selected = true
            });

            return(categories);
        }
Exemplo n.º 9
0
 public ActionResult getallcategory()
 {
     try
     {
         var list = _categoryLogic.GetAll();
         var json = new
         {
             Code = "0000",
             Data = list
         };
         return(Json(json, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new ResponseModel()
         {
             Code = "0009", Msg = ex.Message
         }));
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// get all categories
        /// </summary>
        /// <returns></returns>
        private dynamic GetAllCategories()
        {
            try
            {
                var json = new
                {
                    Code = "0000",
                    Data = _categoryLogic.GetAll()
                };

                return(Response.AsText(JsonConvert.SerializeObject(json), "application/json;charset=UTF-8"));
            }
            catch (Exception ex)
            {
                return(Response.AsText(JsonConvert.SerializeObject(new ResponseModel()
                {
                    Code = "0009", Msg = ex.Message
                }), "application/json;charset=UTF-8"));
            }
        }
Exemplo n.º 11
0
 public IActionResult GetAll()
 {
     return(Ok(CategoryLogic.GetAll().Select(x => new CategoryDetailedInfoModel(x)).ToList()));
 }
Exemplo n.º 12
0
 public ActionResult Index()
 {
     return(View(_categoryLogic.GetAll()));
 }
Exemplo n.º 13
0
 public IEnumerable <CategoryDto> Get()
 {
     return(_categoryLogic.GetAll());
 }