private async Task <ActionResult> ShowCheckInForm(Claim claim) { return(View("CheckIn", new CheckInClaimModel(claim, await GetCurrentUserAsync(), claim.Character == null ? null : await PlotRepository.GetPlotsForCharacter(claim.Character)))); }
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(); }
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))); }
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))); }
private async Task <IReadOnlyList <PlotElement> > ShowPlotsForCharacter(Character character) { return(character.GetOrderedPlots(await PlotRepository.GetPlotsForCharacter(character))); }