public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTopics)) return AccessDeniedView(); var model = new TopicListModel(); //stores model.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Common.All"), Value = "0" }); foreach (var s in _storeService.GetAllStores()) model.AvailableStores.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString() }); return View(model); }
public ActionResult List(DataSourceRequest command, TopicListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTopics)) return AccessDeniedView(); var topicModels = _topicService.GetAllTopics(model.SearchStoreId) .Select(x =>x.ToModel()) .ToList(); //little hack here: //we don't have paging supported for topic list page //now ensure that topic bodies are not returned. otherwise, we can get the following error: //"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. " foreach (var topic in topicModels) { topic.Body = ""; } var gridModel = new DataSourceResult { Data = topicModels, Total = topicModels.Count }; return Json(gridModel); }
public ActionResult List(GridCommand command, TopicListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTopics)) return AccessDeniedView(); var topics = _topicService.GetAllTopics(model.SearchStoreId); var gridModel = new GridModel<TopicModel> { Data = topics.Select(x =>x.ToModel()), Total = topics.Count }; return new JsonResult { Data = gridModel }; }