- public class ValuesController : ApiController
- {
- Database_Access_layer.service db = new Database_Access_layer.service();
-
-
- public DataSet GetRecord()
- {
- DataSet ds = db.GetRecords();
- return ds;
- }
- public class service
- {
- string st = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
- public DataSet GetRecords()
- {
- SqlConnection con = new SqlConnection(st);
- string adp = "";
- adp = @"select s.State_Id, RTRIM(s.State_Name) as state_name,count(1) as totalNo
-
-
-
-
-
-
-
- from BUyer_details
-
-
-
- inner join Vehicles_Details vd on BUyer_details.Vehicles_Id=vd.Vehicles_Id
-
- inner join Model_Registration mr on vd.Model_Code=mr.xEV_Model_Code
-
- left outer join OEM_Registration om on BUyer_details.OEM_Id = om.OEM_Id
-
-
-
- inner join Dealer_Registration dr on BUyer_details.Dealer_Id= dr.Dealer_Id
-
- inner join Mst_Vehicle_Category vc on mr.Vihecle_cat_id=vc.Vihecle_cat_id
-
- inner join tbl_MasterState s on dr.State_Id=s.State_Id
-
- where 1=1 group by s.State_Name,s.State_Id order by State_Id asc";
- SqlDataAdapter aa = new SqlDataAdapter(adp, con);
- DataSet ds = new DataSet();
- aa.Fill(ds);
- return ds;
- }
- }
I tried creating the query and then returning in json format, but it is showing collections, i want a single array