This is my table.
grp_perm_id grp_id Perm_id
23 2 2
27 2 1
28 3 1
29 2 3
I want to retrieve results in the form of array of integers. Below is the code I am trying
public List<int> GetData(int grp_id)
{
// List<ts_grp_perm_mapping> tm = (from c in db.ts_grp_perm_mapping where c.grp_id == grp_id select c).ToList();
int[] selectedradiobuttons = (from c in db.ts_grp_perm_mapping where c.grp_id == grp_id select c).ToArray();
return selectedradiobuttons.ToArray();
}
Here I am receiving grp_id. For example if I receive 2(grp_id) then I want to return array of integers which contains perm_id (2,1,3). If the grp_id is 3 then array of integers contains perm_id(1). How can I do this? In the above code I am getting this error:
cannot implicitly convert type c3card.dal.edmodel.ts_grP_perm[] to int
Can anybody suggest me how to do this? I want to return array of integers.
This is my json code.
public JsonResult GetCheckedPerm(int usr_groupId)
{
List<int> selectedradio = GrpPermBAL.GetData(usr_groupId);
return(selectedradio,JsonRequestBehavior.AllowGet);
}
ToArraytwice?