public async Task <ActionResult> CountryDec(BundelStatusAndCountry id) { if (id.StatusId == null) { ViewBag.Statuse = db.OrderStatuses.ToList(); return(PartialView(await db.Declerations.Where(w => w.CreatAdmin == false && w.CountryId == id.CountryId).ToListAsync())); } else { if (id.StatusId == 100) { ViewBag.Statuse = db.OrderStatuses.ToList(); return(PartialView(await db.Declerations.Where(w => w.CreatAdmin == false && w.CountryId == id.CountryId && w.IsForeignWarehouse == true && (w.OrderStatusId == null || w.OrderStatusId == 9)).ToListAsync())); } else if (id.StatusId == 99) { ViewBag.Statuse = db.OrderStatuses.ToList(); return(PartialView(await db.Declerations.Where(w => w.CreatAdmin == false && w.CountryId == id.CountryId && w.Executed == true).ToListAsync())); } else if (id.StatusId == 98) { ViewBag.Statuse = db.OrderStatuses.ToList(); return(PartialView(await db.Declerations.Where(w => w.CreatAdmin == false && w.CountryId == id.CountryId && w.Executed == false).ToListAsync())); } else { ViewBag.Statuse = db.OrderStatuses.ToList(); return(PartialView(await db.Declerations.Where(w => w.CreatAdmin == false && w.CountryId == id.CountryId && w.OrderStatusId == id.StatusId).ToListAsync())); } } }
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)); }