public ActionResult GetAll()
        {
            dynamic resposonse = new ExpandoObject();

            try
            {
                var item = _categoriaService.GetAll();
                if (item != null)
                {
                    resposonse.data         = item;
                    resposonse.errormensaje = "";
                    resposonse.error        = false;
                }
                else
                {
                    resposonse.data         = null;
                    resposonse.errormensaje = "No Existe Registros";
                    resposonse.error        = true;
                }
            }
            catch (Exception ex)
            {
                resposonse.data         = null;
                resposonse.errormensaje = ex.Message;
                resposonse.error        = true;
            }
            object datos = (object)resposonse;

            return(Ok(datos));
        }
Ejemplo n.º 2
0
        // GET: Producto//con un string no habria problemas ya que ello soportan nulos int? filterByCategoria, hay que ponerlo en este caso al entero de manera explicita que soporte nulos
        //cuando es nullo el parametro filterByCategoria (se ha elegido Todos)
        //**SIN AJAX
        public ActionResult Index(string filterByName, int?filterByCategoria, int?filterByMarca)
        {
            filterByName         = string.IsNullOrWhiteSpace(filterByName) ? "" : filterByName.Trim();
            ViewBag.filterByName = filterByName;
            ViewBag.Categorias   = categoriaServices.GetAll("");
            ViewBag.Marcas       = marcaServices.GetAll("");

            var model = productoServices.GetAll(filterByName, filterByCategoria, filterByMarca);

            return(View(model));
        }
Ejemplo n.º 3
0
 public async Task <ActionResult <DataCollection <CategoriaSimpleDto> > > GetAll(int page, int take)
 {
     return(await _service.GetAll(page, take));
 }
 public async Task <List <Categoria> > Get() => await _categoriaService.GetAll();
Ejemplo n.º 5
0
        public List <Categoria> GetAll()
        {
            var service = new CategoriaService(_categoriaRepository);

            return(service.GetAll());
        }