public PedidosController() { ViewBag.IdCliente = new SelectList( _clienteRep.ConsultarTodos(), "IdCliente", "Nome" ); ViewBag.IdServico = new SelectList( _servicoRep.ConsultarTodos(), "IdServico", "DescricaoServico" ); ViewBag.IdProduto = new SelectList( _produtoRep.ConsultarTodos(), "IdProduto", "DescricaoProduto" ); }
// GET public ActionResult Index(string Pesquisa = "") { //Consultar Todos na Lista var servicoViewModel = Mapper.Map <IEnumerable <Servico>, IEnumerable <ServicoViewModel> > (_servicoRep.ConsultarTodos()); if (!string.IsNullOrEmpty(Pesquisa)) { servicoViewModel = servicoViewModel.Where(c => c.DescricaoServico.Contains(Pesquisa)); } servicoViewModel = servicoViewModel.OrderBy(c => c.DescricaoServico); return(View(servicoViewModel)); }