Exemple #1
0
        public async Task <ActionResult> Create(int?id)
        {
            if (id == null || id == default(int))
            {
                return(View(new ExampleSection()));
            }

            var section = await _sectionService.FindByIdAsync(id.Value);

            if (section == null)
            {
                return(HttpNotFound());
            }

            var newSection = new ExampleSection
            {
                ParentSectionId = id,
                ParentSection   = new ExampleSection(section, false)
            };

            return(View(newSection));
        }