How to call web api check user exist on angular 7 ? RRS feed

  • Question

  • User696604810 posted

    I work on asp.net core web api 

    I have web api check user exist or not and in case of exist return message 

    user exists 

     public static bool CheckUserName(string username)
                bool status = false;
               // string constr = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
                using (SqlConnection conn = new SqlConnection(SQLDAL.ConnectionString))
                    using (SqlCommand cmd = new SqlCommand("CheckUserAvailability", conn))
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserName", username.Trim());
                        status = Convert.ToBoolean(cmd.ExecuteScalar());
                return status;

    so How to receive data on angular 7


    How o create service call CheckUserName ?

    How to call it on ngsubmit when press button to validate ?

    Monday, January 20, 2020 1:08 AM

All replies