Esempio n. 1
0
        /// <summary>
        /// Displays the veteran's profile with options to select libraries or start their intake form
        /// </summary>
        public async Task OnGetAsync()
        {
            Veteran veteran = await _veteranService.GetVeteranByPrincipalAsync(User);

            Libraries = await _libraryService.GetAllLibrariesForVeteranAsync(veteran.ApplicationUserId);

            Match = await _matchService.GetMatchAsync();
        }
        /// <summary>
        /// Allows the veteran to choose up to 3 libraries at which to meet attorneys
        /// </summary>
        public async Task OnGetAsync()
        {
            // Populate a SelectList for the library options on the form using the Library table
            //AllLibraries = new SelectList(_libraryService.GetAllLibraries(), "ID", "Name");

            AllLibraries = new SelectList(await _libraryService.GetAllLibrariesWithLawyers(), "ID", "Name");

            // Get the current signed in Veteran entity
            Veteran veteran = await _veteranService.GetVeteranByPrincipalAsync(User);

            // If the veteran has already chosen some libraries, get those choices for the form via
            // the VeteranLibraryJunction table. Only take 3 choices per the client's request
            SelectedLibraries = veteran.VeteranLibraryJunctions.Select(vlj => vlj.LibraryId)
                                .Take(3)
                                .ToList();
            long libCount = AllLibraries.LongCount();

            // Make sure there are at least three elements in the list to prevent any issues with indexing

            while (SelectedLibraries.Count < 3 && AllLibraries.LongCount() > 0)
            {
                SelectedLibraries.Add(long.Parse(AllLibraries.First().Value));
            }
        }