// GET: Purchases/Create public ActionResult Create() { var providers = providerB.GetAll().ToList(); ViewData["providersCode"] = new SelectList(providers, "IDProvider", "Code"); ViewData["providersCompany"] = new SelectList(providers, "IDProvider", "NameCompany"); var name = providers.Select(u => new { IDProvider = u.IDProvider, Name = u.Name + " " + u.FirstName + " " + u.SecondName }); ViewData["providersName"] = new SelectList(name, "IDProvider", "Name"); return(View()); }
// GET: Clients public ActionResult Index() { List <Int64> clients = clientsB.ClientsAll().ToList(); List <All_Providers> providers = providersB.GetAll().ToList(); foreach (var y in providers) { foreach (var x in clients) { if (y.IDPerson == x) { y.IsClient = true; } } } return(View(providers)); }