public void InsertUpdate(Emp_Insert obj) { if (obj.D == 0) { con.Open(); SqlCommand com = new SqlCommand("InsertProc", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@u_name", obj.A); com.Parameters.AddWithValue("@u_email", obj.B); com.Parameters.AddWithValue("@u_password", obj.C); com.Parameters.AddWithValue("@countryid", obj.E); com.Parameters.AddWithValue("@stateid", obj.F); com.Parameters.AddWithValue("@gender", obj.G); com.Parameters.AddWithValue("@dob", obj.H); com.ExecuteNonQuery(); con.Close(); } else { con.Open(); SqlCommand com = new SqlCommand("updateProc", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@u_name", obj.A); com.Parameters.AddWithValue("@u_email", obj.B); com.Parameters.AddWithValue("@u_password", obj.C); com.Parameters.AddWithValue("@u_id", obj.D); com.Parameters.AddWithValue("@countryid", obj.E); com.Parameters.AddWithValue("@stateid", obj.F); com.Parameters.AddWithValue("@gender", obj.G); com.Parameters.AddWithValue("@dob", obj.H); com.ExecuteNonQuery(); con.Close(); } }
public void Delete(Emp_Insert obj) { con.Open(); SqlCommand com = new SqlCommand("Deleteproc", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@u_id", obj.A); com.ExecuteNonQuery(); con.Close(); }
public JsonResult Edit(Emp_Insert obj) { string data = ""; con.Open(); SqlCommand com = new SqlCommand("Editproc", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@u_id", obj.B); SqlDataAdapter da = new SqlDataAdapter(com); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); data = JsonConvert.SerializeObject(dt); return(Json(data, JsonRequestBehavior.AllowGet)); }