title: asp.net core web api null data issue
body: <p>I'm building an e-commerce site with react and asp.net core web api. User must be registered now. I did the necessary actions in react. When he clicks the register button, he goes to the register controller in the backend and the necessary functions, but the values ​​of the incoming User data are null. what is the problem i can't figure it out</p>
  <p><strong>React.js - register form</strong></p>
  <pre><code>import '../../Css/SignUpPage.css'
  // import { useForm } from 'react-hook-form'
  import { SignUpSchema } from &quot;../../validations/SignUpChema&quot;
  import React from 'react';
  import axios from 'axios'
  import { useFormik } from 'formik'
  
  export default function SingUpPage() {
  
  
      const { handleSubmit, handleChange, values, errors, touched } =
          useFormik({
  
              initialValues: {
                  Name: &quot;&quot;,
                  LastName: &quot;&quot;,
                  Mail:&quot;&quot;,
                  Password: &quot;&quot;,
                  confirm_password: &quot;&quot;,
                
              },
              onSubmit: (values) =&gt; {
                  console.log(values);
                  try {
                  axios({
                      method: &quot;post&quot;,
                      url: &quot;http://localhost:64082/api/users/register&quot;,
                      data: { values }
  
                  });
                  return alert(&quot;Success!&quot;);
                  } catch (error) {
                  return alert(&quot;Error: &quot; + error);
                  }
  
  
  
              },
              validationSchema: SignUpSchema
          })
  
      return (
  
  
          &lt;div&gt;
              &lt;div className=&quot;signup-form&quot;&gt;
                  &lt;form onSubmit={handleSubmit}&gt;
                      &lt;h2&gt;Sign Up&lt;/h2&gt;
                      &lt;p&gt;Please fill in this form to create an account!&lt;/p&gt;
  
                      &lt;div className=&quot;form-group&quot;&gt;
                          &lt;div className=&quot;input-group&quot;&gt;
  
                              &lt;input
                                  type=&quot;text&quot;
                                  className=&quot;form-control&quot;
                                  name='Name'
                                  placeholder=&quot;First Name&quot;
                                  value={values.Name}
                                  onChange={handleChange}
                              /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      {errors.Name &amp;&amp; touched.Name &amp;&amp; (
                          &lt;div &gt;{errors.Name}&lt;/div&gt;
                      )}
  
                      &lt;div className=&quot;form-group&quot;&gt;
                          &lt;div className=&quot;input-group&quot;&gt;
  
                              &lt;input
                                  type=&quot;text&quot;
                                  className=&quot;form-control&quot;
                                  name=&quot;LastName&quot;
                                  placeholder=&quot;Second Name&quot;
                                  value={values.LastName}
                                  onChange={handleChange} /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      {errors.LastName &amp;&amp; touched.LastName &amp;&amp; (
                          &lt;div &gt;{errors.LastName}&lt;/div&gt;
                      )}
  
                      &lt;div className=&quot;form-group&quot;&gt;
                          &lt;div className=&quot;input-group&quot;&gt;
  
                              &lt;input
                                  type=&quot;email&quot;
                                  className=&quot;form-control&quot;
                                  name=&quot;Mail&quot;
                                  placeholder=&quot;Email Address&quot;
                                  value={values.Mail}
                                  onChange={handleChange} /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      {errors.Mail &amp;&amp; touched.Mail &amp;&amp; (
                          &lt;div &gt;{errors.Mail}&lt;/div&gt;
                      )}
  
                      &lt;div className=&quot;form-group&quot;&gt;
                          &lt;div className=&quot;input-group&quot;&gt;
  
                              &lt;input
                                  type=&quot;text&quot;
                                  className=&quot;form-control&quot;
                                  name=&quot;Password&quot;
                                  placeholder=&quot;Password&quot;
                                  value={values.Password}
                                  onChange={handleChange} /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      {errors.Password &amp;&amp; touched.Password &amp;&amp; (
                          &lt;div &gt;{errors.Password}&lt;/div&gt;
                      )}
  
                      &lt;div className=&quot;form-group&quot;&gt;
                          &lt;div className=&quot;input-group&quot;&gt;
  
                              &lt;input
                                  type=&quot;text&quot;
                                  className=&quot;form-control&quot;
                                  name=&quot;confirm_password&quot;
                                  placeholder=&quot;Confirm Password&quot;
                                  value={values.confirm_password}
                                  onChange={handleChange} /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      {errors.confirm_password &amp;&amp; touched.confirm_password &amp;&amp; (
                          &lt;div &gt;{errors.confirm_password}&lt;/div&gt;
                      )}
  
                      &lt;button
                          type=&quot;submit&quot;
                          className=&quot;btn btn-primary btn-lg&quot;&gt;
                          Sign Up
                      &lt;/button&gt;
  
                  &lt;/form&gt;
                  &lt;div className=&quot;text-center&quot;&gt;Already have an account? - Login here&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
      );
  
  
  }
  </code></pre>
  <p><strong>Asp.net core - user controller-register funct</strong></p>
  <pre><code> [HttpPost(&quot;register&quot;)]
          public async Task&lt;IActionResult&gt; Register (User oUser)
          {
              var result = _userService.Register(oUser);
  
              if (result != null)
              {
                  return Ok(result);
              }
              return BadRequest(result);
          }
  </code></pre>
  <p><strong>My DataAccess Layer Register Repository</strong></p>
  <pre><code>using Core.Common;
  using DataAccessLayer.Abstract;
  using EntityLayer.Concrete;
  using Microsoft.EntityFrameworkCore;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Security.Cryptography;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace DataAccessLayer.Concrete
  {
      public class UserRepository : GenericRepository&lt;User&gt;, IUserDal
      {
  
  
  
          public string HashPassword(string password)
          {
              SHA256 hash = SHA256.Create();
  
              var passwordBytes = Encoding.Default.GetBytes(password);
  
              var hashedpassword = hash.ComputeHash(passwordBytes);
  
              return Convert.ToHexString(hashedpassword);;
          }
  
          public async Task Login(User user)
          {
              var userfound = dbContext.Users.Any(u =&gt; u.Mail == user.Mail);
  
              if (userfound)
              {
                  var loginuser = await dbContext.Users.FirstOrDefaultAsync(u =&gt; u.Mail == user.Mail);
  
  
                  if (HashPassword($&quot;{user.Password}{loginuser.PasswordKey}&quot;) == loginuser.Password)
                  {
  
                      Console.WriteLine(user.Name + &quot; başarılı şekilde giriş yapıldı...&quot;);
  
                  }
                  else
                  {
  
                      Console.WriteLine(&quot; giriş yapılamadı...&quot;);
                  }
  
              }
  
  
          }
  
          //new User() { Name = user.Name, LastName = user.LastName, Password = HashedPW, PasswordKey = salt,Mail = user.Mail }
          public async Task Register(User user)
          {   
  
              
              var salt = DateTime.Now.ToString();
  
              var HashedPW = HashPassword($&quot;{user.Password}{salt}&quot;);
  
              await dbContext.Users.AddAsync(new User { Name = user.Name, LastName = user.LastName, Password = HashedPW, PasswordKey = salt, Mail = user.Mail });
              dbContext.SaveChanges();
          }
      }
  }
  </code></pre>
  <p><strong>My User entity</strong></p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace EntityLayer.Concrete
  {
      public class User
      {
  
  
          [Key]
          public int UserID { get; set; }
  
          
          public string Name { get; set; }
  
          public string LastName { get; set; }
  
          public string Mail { get; set; }
  
          public string Password { get; set; }
  
          public string PasswordKey { get; set; }
          public List&lt;Product&gt; Products { get; set; }  
  
    
      }
  }
  </code></pre>
  <p>When I look at the values ​​of the user coming to the register function in the data access layer, I see that all of these values ​​are null, so it cannot be added to the database.</p>
  <p><strong>Null Datas in DataAccess Layer Register func</strong></p>
  <ol>
  <li>Name</li>
  <li>LastName</li>
  <li>Mail</li>
  <li>Password</li>
  <li>PasswordKey</li>
  <li>Products</li>
  </ol>
  <p>UserID is not null is equal zero</p>