public ActionResult GetProductoById(int productoId)
        {
            dynamic resposonse = new ExpandoObject();

            try
            {
                var item = _productoService.GetById(productoId);
                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));
        }
Esempio n. 2
0
        public ActionResult Edit(int id)
        {
            ViewBag.Categorias      = categoriaServices.GetAll("");
            ViewBag.Marcas          = marcaServices.GetAll("");
            ViewBag.UnidadesMedidas = unidadMedidaServices.GetAll("");
            var model = productoServices.GetById(id);

            return(View("Create", model));//Reutilizando la vista create para la edicion
        }
 public async Task <ActionResult <ProductoDto> > GetById(int id)
 {
     return(await _service.GetById(id));
 }
Esempio n. 4
0
 public ActionResult GetById(int ProductoId)
 {
     return(Ok(_productoService.GetById(ProductoId)));
 }