public IActionResult Index(string groupId, int sectionId)
        {
            DoctrinaGroup          currentGroup   = _doctrinaGroupRepository.GetGroup(groupId);
            DoctrinaGroupSection   currentSection = _doctrinaGroupRepository.GetSection(sectionId);
            IList <DoctrinaScript> scripts        = _doctrinaGroupRepository.GetScripts(sectionId);

            SectionIndexViewModel model = new SectionIndexViewModel
            {
                Group          = currentGroup,
                CurrentSection = currentSection,
                Scripts        = scripts
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(CreateGroupViewModel model)
        {
            if (ModelState.IsValid)
            {
                var currentUser = await _userManager.FindByNameAsync(User.Identity.Name);

                DoctrinaGroup newGroup = _doctrinaGroupRepository.CreateGroup(model, currentUser.Id);
                if (newGroup != null)
                {
                    return(Redirect($"/groups/{newGroup.Id}"));
                }
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Index(string id)
        {
            DoctrinaGroup  group = _doctrinaGroupRepository.GetGroup(id);
            GroupViewModel model = new GroupViewModel
            {
                Group    = group,
                Members  = new List <DoctrinaUser>(),
                Sections = _doctrinaGroupRepository.GetSections(id)
            };

            foreach (var userId in _doctrinaGroupRepository.GetGroupMemberIds(id))
            {
                var user = await _userManager.FindByIdAsync(userId);

                model.Members.Add(user);
            }

            return(View(model));
        }