public object removePax(int ticket_id, int pax_id) { try { RemovePax removePax = new RemovePax(); removePax = db.removePax(ticket_id, pax_id); object response = new object(); if (removePax == null) { response = new { Status = "false", Message = "Authentication failed" }; } else { response = new { Status = "true", Payment = removePax }; } return(JsonConvert.SerializeObject(response, Newtonsoft.Json.Formatting.Indented)); } catch (Exception) { throw; } }
internal RemovePax removePax(int ticket_id, int pax_id) { try { SqlCommand cmd = new SqlCommand("removePax", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ticket_id", ticket_id); cmd.Parameters.AddWithValue("@pax_id", pax_id); con.Open(); RemovePax removePax = new RemovePax(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dRow in ds.Tables[0].Rows) { removePax.status = true; removePax.pax.anniversary = dRow["anniversary"] != DBNull.Value ? Convert.ToInt32(dRow["anniversary"].ToString()) : 0; removePax.pax.id = dRow["id"] != DBNull.Value ? Convert.ToInt32(dRow["id"].ToString()) : 0; removePax.pax.dob = dRow["dob"] != DBNull.Value ? Convert.ToInt32(dRow["dob"].ToString()) : 0; removePax.pax.email = dRow["email"] != DBNull.Value ? dRow["email"].ToString() : ""; removePax.pax.name = dRow["name"] != DBNull.Value ? dRow["name"].ToString() : ""; removePax.pax.mobile = dRow["mobile"] != DBNull.Value ? dRow["mobile"].ToString() : ""; } } return(removePax); } catch (Exception ex) { throw; } finally { con.Close(); } }