public JsonResult GetArticleSubsections(int sectionId) { if (!Request.IsAjaxRequest()) { throw new InvalidCastException("Not an ajax request"); } var subsections = new List <object>(); foreach (var s in _articleSubsectionRepository.ReadBySection(sectionId)) { subsections.Add(new { Id = s.Id, Name = s.Name }); } return(Json(subsections)); }
private void PopulateSubsectionDropDownList(int sectiondId, object selectedSubsection) { var subsections = _subsectionRepository.ReadBySection(sectiondId).OrderBy(c => c.Name); ViewBag.Subsections = new SelectList(subsections, "Id", "Name", selectedSubsection); }