public async Task <IActionResult> Edit([FromBody] ApplicationUserRegistrationModel model)
        {
            var user = await userManager.GetUserAsync(HttpContext.User);

            if (user != null)

            {
                user.Email       = model.Email;
                user.UserName    = model.Username;
                user.Image       = model.Image;
                user.LastEdit    = DateTime.UtcNow;
                user.FirstName   = model.FirstName;
                user.LastName    = model.LastName;
                user.DateOfBirth = model.DateOfBirth.Date;

                var result = await userManager.UpdateAsync(user);

                if (result.Succeeded)
                {
                    return(Ok());
                }
                else
                {
                    return(BadRequest(result.Errors));
                }
            }
            return(BadRequest("Could not find user, are you signed in?"));
        }
        public async Task <ApplicationUserRegistrationModel> Get()
        {
            var user = await userManager.GetUserAsync(HttpContext.User);

            var model = new ApplicationUserRegistrationModel()
            {
                Username    = user.UserName,
                Email       = user.Email,
                DateOfBirth = user.DateOfBirth.Date,
                FirstName   = user.FirstName,
                LastName    = user.LastName,
                Gender      = user.Gender,
                Image       = user.Image,
            };

            return(model);
        }
        public async Task <IActionResult> Register([FromBody] ApplicationUserRegistrationModel model)
        {
            EnsureDatabaseCreated(applicationDbContext);
            Console.Write(model.Username);
            if (ModelState.IsValid)
            {
                var createdTime = DateTime.UtcNow;
                var user        = new ApplicationUser()
                {
                    UserName    = model.Username,
                    Email       = model.Email,
                    LastName    = model.LastName,
                    FirstName   = model.FirstName,
                    DateOfBirth = model.DateOfBirth,
                    Image       = model.Image,
                    Gender      = model.Gender,
                    JoinedDate  = createdTime,
                    LastEdit    = createdTime,
                };

                var result = await userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    return(Ok());
                }
                else
                {
                    foreach (var item in result.Errors)
                    {
                        System.Diagnostics.Debug.WriteLine(item.Description);
                    }
                }
            }
            return(BadRequest());
        }