public async Task <ActionResult> ChangeCountryInIndexBundel(BundelStatusAndCountry id) { List <GetIndexBundel> GetIndex = new List <GetIndexBundel>(); if (id.StatusId == null && id.CountryId != null) { var bundellist = await db.Bundels.Where(w => w.CountryId == id.CountryId).ToListAsync(); foreach (var j in bundellist) { GetIndex.Add(GetIndexBundel.Create(j)); } } else if (id.CountryId == null && id.StatusId != null) { var bundellist = await db.Bundels.Where(w => w.OrderStatusId == id.StatusId).ToListAsync(); foreach (var j in bundellist) { GetIndex.Add(GetIndexBundel.Create(j)); } } else if (id.CountryId != null && id.StatusId != null) { var bundellist = await db.Bundels.Where(w => w.OrderStatusId == id.StatusId && w.CountryId == id.CountryId).ToListAsync(); foreach (var j in bundellist) { GetIndex.Add(GetIndexBundel.Create(j)); } } else { var bundellist = await db.Bundels.ToListAsync(); foreach (var j in bundellist) { GetIndex.Add(GetIndexBundel.Create(j)); } } ViewBag.status = await db.OrderStatuses.ToListAsync(); ViewBag.counry = await db.Countries.ToListAsync(); return(PartialView(GetIndex)); }
// GET: Default public async Task <ActionResult> Index() { var bundellist = await db.Bundels.ToListAsync(); List <GetIndexBundel> GetIndex = new List <GetIndexBundel>(); foreach (var j in bundellist) { GetIndex.Add(GetIndexBundel.Create(j)); } ViewBag.status = await db.OrderStatuses.ToListAsync(); ViewBag.counry = await db.Countries.ToListAsync(); return(View(GetIndex)); }