コード例 #1
0
 private async Task <ActionResult> ShowCheckInForm(Claim claim)
 {
     return(View("CheckIn", new CheckInClaimModel(claim, await GetCurrentUserAsync(),
                                                  claim.Character == null
   ? null
   : await PlotRepository.GetPlotsForCharacter(claim.Character))));
 }
コード例 #2
0
        public async Task MoveElement(int projectId, int plotElementId, int parentCharacterId, int direction)
        {
            var character = await LoadProjectSubEntityAsync <Character>(projectId, parentCharacterId);

            character.RequestMasterAccess(CurrentUserId, acl => acl.CanEditRoles);

            var plots = await PlotRepository.GetPlotsForCharacter(character);

            var voc     = character.GetCharacterPlotContainer(plots);
            var element = plots.Single(p => p.PlotElementId == plotElementId);

            switch (direction)
            {
            case -1:
                voc.MoveUp(element);
                break;

            case 1:
                voc.MoveDown(element);
                break;

            default:
                throw new ArgumentException(nameof(direction));
            }

            character.PlotElementOrderData = voc.GetStoredOrder();
            await UnitOfWork.SaveChangesAsync();
        }
コード例 #3
0
        public async Task <ActionResult> Character(int projectid, int characterid)
        {
            var character = await CharacterRepository.GetCharacterWithGroups(projectid, characterid);

            var error = WithCharacter(character);

            if (error != null)
            {
                return(error);
            }

            return(View(new PrintCharacterViewModel(CurrentUserId, character, await PlotRepository.GetPlotsForCharacter(character), UriService)));
        }
コード例 #4
0
        public async Task <IActionResult> Character(int projectid, int characterid)
        {
            var character = await CharacterRepository.GetCharacterWithGroups(projectid, characterid);

            if (character == null)
            {
                return(NotFound());
            }
            if (!character.HasAnyAccess(CurrentUserId))
            {
                return(NoAccesToProjectView(character.Project));
            }

            return(View(new PrintCharacterViewModel(CurrentUserId, character, await PlotRepository.GetPlotsForCharacter(character), UriService)));
        }
コード例 #5
0
 private async Task <IReadOnlyList <PlotElement> > ShowPlotsForCharacter(Character character)
 {
     return(character.GetOrderedPlots(await PlotRepository.GetPlotsForCharacter(character)));
 }