public ActionResult WishListUpdation(int SeletedGroup) { //if (ModelState.IsValid) //{ DataSet ds = new DataSet(); Connection.Connection con = new Connection.Connection(); WhishUpdationModel lmd = new WhishUpdationModel(); ds = con.GoodGroupDataNull(); foreach (DataRow dr in ds.Tables[0].Rows) { lmd.Groups.Add(new GoodGroup { GG_Id = Convert.ToInt16(dr["GG_Id"]), GG_Name = dr["GG_Name"].ToString() }); } //} lmd.SeletedGroup = SeletedGroup; ds = con.GoodData(lmd.SeletedGroup); lmd.Goods.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { lmd.Goods.Add(new GoodModel { Gd_Id = Convert.ToInt16(dr["Gd_Id"]), Gd_Name = dr["Gd_Name"].ToString(), Gd_RequiredNo = Convert.ToInt16(dr["Gd_RequiredNo"]) }); } lmd.AddingGood.GG_Id = Convert.ToInt16(lmd.SeletedGroup); return(View(lmd)); }
public ActionResult WishList() { List <GoodGroup> lmd = new List <GoodGroup>(); DataSet ds = new DataSet(); Connection.Connection con = new Connection.Connection(); ds = con.GoodGroupData(); DataSet ds_good = new DataSet(); Connection.Connection con_good = new Connection.Connection(); foreach (DataRow dr in ds.Tables[0].Rows) { List <GoodModel> lmd_good = new List <GoodModel>(); var Gg_Id = Convert.ToInt32(dr["GG_Id"]); ds_good = con_good.GoodData(Gg_Id); //lmd_good.RemoveAll(true); foreach (DataRow dr_good in ds_good.Tables[0].Rows) { lmd_good.Add(new GoodModel { Gd_Id = Convert.ToInt32(dr_good["Gd_Id"]), Gd_Name = dr_good["Gd_Name"].ToString(), Gd_RequiredNo = Convert.ToInt32(dr_good["Gd_RequiredNo"]) }); } lmd.Add(new GoodGroup { GG_Id = Convert.ToInt16(dr["GG_Id"]), GG_Name = dr["GG_Name"].ToString(), Goods = new List <GoodModel>(lmd_good), }); } return(View("WishList", lmd)); }