using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using PositioningWebApp.DBServices;
using PositioningWebApp.Models.Ajax;
using PositioningWebApp.Models.DB;
using PositioningWebApp.Models.UserProfile;

namespace PositioningWebApp.Pages.Home.Profile
{
    public class UserNameSectionModel : PageModel
    {
		private DevicesOnMapBackgroundContext databaseManager;
		public UserNameSectionModel(DevicesOnMapBackgroundContext context)
		{
			try
			{
				databaseManager = context;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void OnGet()
        {
        }

		public JsonResult OnPostUserName([FromBody] Select s)
		{
			string firstName = User.Claims.ToList()[0].Value;
			string surname = User.Claims.ToList()[1].Value;
			UserProfile profile = new UserProfile
			{
				FirstName = firstName,
				Surname = surname
			};
			return new JsonResult(profile);
		}
    }
}