public void FillItem() { var repo = new SupplierItemRateRepository(); var list = repo.FillItem(); ViewBag.Itemlist = new SelectList(list, "Id", "Name"); }
public ActionResult SupplierItemRateList(int?SupplierId) { FillItem(); SupplierItemRate SupplierItemRate = new SupplierItemRate(); SupplierItemRate.SupplierItemRateItem = new List <SupplierItemRateItem>(); if (SupplierId == null || SupplierId == 0) { var SupplierItemRateItem = new SupplierItemRateItem(); SupplierItemRate.SupplierItemRateItem.Add(SupplierItemRateItem); } else { var repo = new SupplierItemRateRepository(); SupplierItemRate.SupplierItemRateItem = repo.GetItem(SupplierId).ToList(); } if (SupplierItemRate.SupplierItemRateItem.Count == 0) { SupplierItemRate.SupplierItemRateItem.Add(new SupplierItemRateItem()); } return(PartialView("SupplierItemRateList", SupplierItemRate)); }