public ActionResult Create() { IQueryable <Item> lstItem = itemAssignmentRepo.List().Where(p => p.CompanyId == Sessions.CompanyId.Value).Select(p => p.Item); ViewBag.Vendors = new SelectList(context.Vendors.Where(p => p.Active), "Id", "Name"); ViewBag.Items = new SelectList(lstItem.Where(p => p.Active).OrderBy(p => p.Description), "Id", "Description"); ViewBag.User = Common.GetCurrentUser.FullName; ViewBag.GeneralManager = Common.GetCurrentUser.GeneralManager.FullName; ViewBag.Update = "0"; PurchaseOrder reqPurchase = new PurchaseOrder { Vendor = new Vendor(), No = rpRepo.GenerateRpNo(DateTime.Now), Date = DateTime.Now }; return(View(reqPurchase)); }