source: PostgreSqlDotnetCore/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs

main
Last change on this file was 2aea0fd, checked in by ElenaMoskova <elena.moskova99@…>, 2 months ago

init commit Elena

  • Property mode set to 100644
File size: 1.1 KB
Line 
1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3using System;
4using System.Threading.Tasks;
5using Microsoft.AspNetCore.Identity;
6using Microsoft.AspNetCore.Mvc;
7using Microsoft.AspNetCore.Mvc.RazorPages;
8using Microsoft.Extensions.Logging;
9
10namespace PostgreSqlDotnetCore.Areas.Identity.Pages.Account.Manage
11{
12 public class PersonalDataModel : PageModel
13 {
14 private readonly UserManager<IdentityUser> _userManager;
15 private readonly ILogger<PersonalDataModel> _logger;
16
17 public PersonalDataModel(
18 UserManager<IdentityUser> userManager,
19 ILogger<PersonalDataModel> logger)
20 {
21 _userManager = userManager;
22 _logger = logger;
23 }
24
25 public async Task<IActionResult> OnGet()
26 {
27 var user = await _userManager.GetUserAsync(User);
28 if (user == null)
29 {
30 return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
31 }
32
33 return Page();
34 }
35 }
36}
Note: See TracBrowser for help on using the repository browser.