示例#1
0
        public async Task <ActionResult> GetSectionChilds(int?idSection)
        {
            string  currentUserId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            Section section       = await Section.GetIfHaveAccess(_db, currentUserId, idSection);

            await section.LoadChildsIfAccess(_db, currentUserId);

            OneSectionV res = new OneSectionV()
            {
                Section = section, UserId = currentUserId
            };

            return(PartialView(res));
        }
示例#2
0
        public async Task <ActionResult> CreateSection(int?idParentSection, string head)
        {
            string  currentUserId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            Section section       = await Section.GetIfHaveAccess(_db, currentUserId, idParentSection);

            var newSection = await section?.TryAddSectionToChilds(_db, head, currentUserId, idParentSection);

            if (newSection == null)
            {
                return(StatusCode(400));
            }
            OneSectionV res = new OneSectionV()
            {
                Section = newSection, UserId = currentUserId
            };

            return(PartialView(res));
        }