public IEnumerable <SelectListItem> GetCategories() { var categories = _categoryLogic.GetAll().ToList(). Select(s => new SelectListItem { Text = s.Name, Value = s.Id.ToString() }).ToList(); return(categories); }
public IActionResult Index() { var categories = _categoryLogic.GetAll(); var products = _productLogic.GetAll(); var model = new ShopViewModel { Categories = categories, Products = products }; return View(model); }
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")); } }; }
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)); }
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)); } }
/// <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")); }
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); }
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 })); } }
/// <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")); } }
public IActionResult GetAll() { return(Ok(CategoryLogic.GetAll().Select(x => new CategoryDetailedInfoModel(x)).ToList())); }
public ActionResult Index() { return(View(_categoryLogic.GetAll())); }
public IEnumerable <CategoryDto> Get() { return(_categoryLogic.GetAll()); }