예제 #1
0
 // GET: Pedido/Create
 public ActionResult Create()
 {
     ViewBag.ClienteId = new SelectList(clienteRepository.ObterTodos().Select(c => new ClienteSet {
         Id = c.Id, Nome = string.Concat(c.Nome, " ", c.Sobrenone)
     }), "Id", "Nome");
     ViewBag.Endereco_Id     = new SelectList(enderecoRepository.ObterTodos(), "Id", "Logradouro");
     ViewBag.TipoEntregaId   = new SelectList(tipoEntregaRepository.ObterTodos(), "Id", "Nome");
     ViewBag.TipoPagamentoId = new SelectList(tipoPagamentoRepository.ObterTodos(), "Id", "Nome");
     ViewBag.Status          = new SelectList(Enum.GetValues(typeof(StatusPedidoEnum)).Cast <StatusPedidoEnum>().Select(p => new SelectListItem {
         Text = ((int)p).ToString(), Value = p.ToString()
     }), "Text", "Value");
     return(View());
 }
예제 #2
0
        private void CarregarDropDown(PedidoClienteViewModel model)
        {
            ViewBag.Produtos = produtoRepository.ObterTodos().Where(p => p.Ativo == true).ToList();
            ViewBag.Clientes = clienteRepository.ObterTodos().Where(c => c.Ativo == true).ToList();

            if (model != null)
            {
                ViewBag.Enderecos     = enderecoRepository.ObterTodos().Where(p => p.ClienteId == model.Cliente).ToList();
                ViewBag.TipoEntrega   = new SelectList(tipoEntregaRepository.ObterTodos(), "Id", "Nome", model.TipoEntrega);
                ViewBag.TipoPagamento = new SelectList(tipoPagamentoRepository.ObterTodos(), "Id", "Nome", model.TipoPagamento);
            }
            else
            {
                ViewBag.TipoEntrega   = new SelectList(tipoEntregaRepository.ObterTodos(), "Id", "Nome");
                ViewBag.TipoPagamento = new SelectList(tipoPagamentoRepository.ObterTodos(), "Id", "Nome");
            }
        }
예제 #3
0
 // GET: TipoEntrega
 public ActionResult Index()
 {
     return View(tipoEntregaRepository.ObterTodos());
 }