// 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)); }
public ActionResult GetAll() { dynamic resposonse = new ExpandoObject(); try { var item = _productoService.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)); }
public List <EProducto> GetAll() { var lista = new List <EProducto>(); try { lista = productoService.GetAll(); } catch (Exception ex) { throw ex; } return(lista); }
public async Task <ActionResult <DataCollection <ProductoSimpleDto> > > GetAll(int page, int take) { return(await _service.GetAll(page, take)); }