// GET: api/Client public IHttpActionResult Get() { IList <All_Clients> clients = null; ClientsB clientB = new ClientsB(); clients = clientB.GetAll(); if (clients == null) { return(Ok(false)); } return(Ok(clients)); }
// GET: Clients public ActionResult Index() { List <All_Clients> clients = clientsB.GetAll().ToList(); List <Int64> providers = providersB.ProvidersAll().ToList(); foreach (var y in clients) { foreach (var x in providers) { if (y.IDPerson == x) { y.IsProvider = true; } } } return(View(clients)); }
// GET: Sales/Create public ActionResult Create() { var clients = clientsB.GetAll().ToList(); ViewData["clientsCode"] = new SelectList(clients, "IdClient", "Code"); ViewData["clientsCompany"] = new SelectList(clients, "IdClient", "NameCompany"); var name = clients.Select(u => new { IdClient = u.IDClient, Name = u.Name + " " + u.FirstName + " " + u.SecondName }); ViewData["clientsName"] = new SelectList(name, "IDClient", "Name"); var products = productsB.GetAll().ToList(); ViewData["productsName"] = new SelectList(products, "IdProduct", "Name"); ViewData["productsCode"] = new SelectList(products, "IdProduct", "Code"); return(View()); }