public int InsertCustomer(Customer_Model c) { int count = 0; Connection(); SqlCommand cmd = new SqlCommand("uspInsertIntoCustomer", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@email", c.Email); cmd.Parameters.AddWithValue("@first", c.FirstName); cmd.Parameters.AddWithValue("@last", c.LastName); cmd.Parameters.AddWithValue("@phone", c.Phone); cmd.Parameters.AddWithValue("@pass", c.Password); try { con.Open(); count = cmd.ExecuteNonQuery(); } catch (Exception ex) { message = ex.Message; } finally { con.Close(); } return(count); }
public string CheckLogin(Customer_Model c) { c.FirstName = null; Connection(); SqlDataReader reader; SqlCommand command = new SqlCommand("uspCheckLogin", con); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@email", c.Email); command.Parameters.AddWithValue("@pass", c.Password); try { con.Open(); reader = command.ExecuteReader(); while (reader.Read()) { c.FirstName = reader["FirstName"].ToString(); } } catch (Exception ex) { message = ex.Message; } finally { con.Close(); } return(c.FirstName); }