예제 #1
0
        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));
        }
예제 #2
0
        private void PopulateSubsectionDropDownList(int sectiondId, object selectedSubsection)
        {
            var subsections = _subsectionRepository.ReadBySection(sectiondId).OrderBy(c => c.Name);

            ViewBag.Subsections = new SelectList(subsections, "Id", "Name", selectedSubsection);
        }