//--------------------------------------------------------------------------
        // GET: ProdutoController/Create
        public ActionResult Create()
        {
            var categorias = _categoriaService.GetAll();

            ViewData["CategoriaId"] = new SelectList(categorias, "Id", "Descricao");
            return(View());
        }
Beispiel #2
0
        public IActionResult Create()
        {
            var ComplementoCateg = new ComplementoCategoriaBind();
            var Categorias       = _categoriaService.GetAll();
            var Categs           = new SelectList(Categorias, "Codigo", "Descricao");

            ComplementoCateg.Categorias = Categs;
            return(View(ComplementoCateg));
        }
Beispiel #3
0
        // GET: Producto
        public ActionResult Index(string filterByName, int?filterByCategoria)
        {
            filterByName         = string.IsNullOrWhiteSpace(filterByName) ? "" : filterByName.Trim();
            ViewBag.filterByName = filterByName;
            ViewBag.Categorias   = categoriaService.GetAll("");

            var model = productoService.GetAll(filterByName, filterByCategoria);

            return(View(model));
        }
Beispiel #4
0
        public IActionResult Cadastrar()
        {
            var viewModel = new CadastrarRegistroViewModel();

            var categorias = _categoriaService.GetAll();

            viewModel.Categorias = categorias.Select(a => new SelectListItem(a.Nome, a.Id.ToString()));

            return(View(viewModel));
        }
        public IActionResult Editar(int Codigo)
        {
            var Produto = _produtoService.Get(Codigo);

            var Categorias = _categoriaService.GetAll();

            Produto.Categorias = new SelectList(Categorias, "Codigo", "Descricao", Produto.CategoriaID);

            var Medida = new Medida();

            Produto.Medidas = new SelectList(Medida.GetAll(), "Codigo", "Descricao", Produto.MedidaID);

            return(View(Produto));
        }
        public ActionResult Buscar(string filtroPorNombre)
        {
            filtroPorNombre = filtroPorNombre != null ? filtroPorNombre : "";
            var model = categoriaServices.GetAll(filtroPorNombre);

            return(PartialView("IndexListado", model));
        }
        // GET: empresas/NovoOuEditar
        public async Task <ActionResult> NovoOuEditar(int id)
        {
            var itemsCategorias = await _serviceCategoria.GetAll();

            List <SelectListItem> items = new List <SelectListItem>();



            foreach (var categoriaDto in itemsCategorias)
            {
                items.Add(new SelectListItem {
                    Text = categoriaDto.CategoriaNome, Value = categoriaDto.Id.ToString()
                });
            }


            ViewData["CategoriaId"] = new SelectList(items, "Value", "Text");

            var status = new[] {
                new SelectListItem()
                {
                    Value = "ATIVO", Text = "Ativo"
                },
                new SelectListItem()
                {
                    Value = "INATIVO", Text = "Inativo"
                }
            };

            ViewData["EmpresaStatus"] = new SelectList(status, "Value", "Text");


            if (id == 0)
            {
                return(View(new EmpresaDTOCreate()));
            }
            else
            {
                var emp = await _service.Get(id);

                var e = _mapper.Map <EmpresaDTOCreate>(emp);

                return(View(e));
            }
        }
        public IActionResult Index()
        {
            var Categoria = _categoriaService.GetAll();

            if (Categoria == null)
            {
                return(RedirectToAction("Error", "PageError"));
            }

            return(View(Categoria));
        }
 //[Authorize("Bearer")]
 public async Task <ActionResult> GetAll()
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState)); //400 bad request - solicitaçao invalidos
     }
     try
     {
         return(Ok(await _service.GetAll()));
     }
     catch (ArgumentException e)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
     }
 }
        public async Task <IActionResult> Index([FromForm] string BuscarString, int pagina = 1)
        {
            var categorias = await _serService.GetAll();


            var cat = from m in categorias
                      select m;



            if (!string.IsNullOrEmpty(BuscarString))
            {
                categorias = cat.Where(s => s.CategoriaNome.ToUpper().Contains(BuscarString.ToUpper()));
            }

            categorias = categorias.OrderBy(c => c.CategoriaNome).ToPagedList(pagina, 5);


            return(View(categorias));
        }
Beispiel #11
0
 public IEnumerable <CategoriaViewModel> ObterTodos(bool @readonly = false)
 {
     return(_mapper.Map <IEnumerable <CategoriaViewModel> >(_categoriaService.GetAll(@readonly)));
 }
 public ActionResult Get()
 {
     return(Ok(categoriaService.GetAll()));
 }
 public IEnumerable <CategoriaViewModel> GetAll()
 {
     return(Mapper.Map <IEnumerable <Categoria>, IEnumerable <CategoriaViewModel> >(_modelService.GetAll()));
 }
Beispiel #14
0
        public ActionResult Index()
        {
            var categorias = _categoriaService.GetAll();

            return(View("Index", categorias));
        }
Beispiel #15
0
 public async Task <IEnumerable <Categoria> > Get()
 {
     return(await _categoriaService.GetAll());
 }
Beispiel #16
0
 public IActionResult GetCategorias()
 {
     return(Ok(_categoriaService.GetAll()));
 }
Beispiel #17
0
 public IActionResult Get()
 {
     return(Json(
                _categoriaService.GetAll()
                ));
 }
 private void LoadModel(EstabelecimentoViewModel model)
 {
     model.Categorias = new SelectList(_categoriaService.GetAll(), "id", "nome");
 }
Beispiel #19
0
 public IEnumerable <Categoria> ObterCategoriasEspeciais()
 {
     return(_categoriaService.ObterCategoriasEspeciais(_categoriaService.GetAll()));
 }
Beispiel #20
0
 public ActionResult <IEnumerable <Categoria> > GetAll()
 {
     return(Ok(_ICategoriaService.GetAll()));
 }
        //--------------------------------------------------------------------------
        // GET: CategoriaController
        public ActionResult Index()
        {
            var categoriaViewModel = _mapper.Map <IEnumerable <Categoria>, IEnumerable <CategoriaViewModel> >(_categoriaService.GetAll());

            return(View(categoriaViewModel));
        }
Beispiel #22
0
        public async Task <IEnumerable <CategoriaViewModel> > ObterTodos()
        {
            var retorno = await _categoriaService.GetAll();

            return(_mapper.Map <List <CategoriaViewModel> >(retorno));
        }
Beispiel #23
0
        // GET: Categoria
        public ActionResult Index()
        {
            var model = categoriaServices.GetAll("");

            return(View(model));
        }
Beispiel #24
0
 public async Task <IHttpActionResult> Lista()
 {
     return(Ok(await Task.FromResult(_categoriaService.GetAll())));
 }