using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using FSA.Data; using FSA.Models; using Microsoft.AspNetCore.Identity; namespace FSA.Pages.Activities { public class IndexModel : PageModel { private readonly FSA.Data.ApplicationDbContext _context; public IndexModel(FSA.Data.ApplicationDbContext context) { _context = context; } public IList<activity> Activity { get; set; } public async Task OnGetAsync() { // get user's Name (email address) from Identity (dbo.AspNetUsers) string userName = User.Identity.Name; // get users last and first name (fname) from Identity with userName as a filter var pubNameQuery = from n in _context.Users.AsNoTracking() where n.UserName == userName select n.LastName + ", " + n.FirstName; string fname = await pubNameQuery.SingleAsync(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)