ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 281.4k

How to return user already exist on angular 7 ?

Jan 20 2020 7:16 AM
problem
How to return user already exist on angular 7 ?
I work on web api working on asp.net core 2
I check users exist on database 
if user i create exist on database then message will show to me
user already exist
  1. public static bool CheckUserName(string username)  
  2.        {  
  3.            bool status = false;  
  4.           // string constr = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;  
  5.            using (SqlConnection conn = new SqlConnection(SQLDAL.ConnectionString))  
  6.            {  
  7.                using (SqlCommand cmd = new SqlCommand("CheckUserAvailability", conn))  
  8.                {  
  9.                    cmd.CommandType = CommandType.StoredProcedure;  
  10.                    cmd.Parameters.AddWithValue("@UserName", username.Trim());  
  11.                    conn.Open();  
  12.                    status = Convert.ToBoolean(cmd.ExecuteScalar());  
  13.                    conn.Close();  
  14.                }  
  15.            }  
  16.            return status;  
  17.        }  
so How to create service on angular 7
and how to call it on Onsubmit event  

Answers (5)