Exemple #1
0
        public ActionResult GuardarAlta([FromBody] DTOCarritoItem nuevoItem)
        {
            if (!ModelState.IsValid)
            {
                return(View("Error", new Error()
                {
                    Message = "Error in data"
                }));
            }

            if (nuevoItem.ItemInventario != null)
            {
                if (nuevoItem.ItemInventario.Catalogo == null)
                {
                    var auxCatalogoItem = RepoCatalogo.ObtenerXID(nuevoItem.ItemInventario.CatalogoId.Value);
                    nuevoItem.ItemInventario.Catalogo = auxCatalogoItem;
                }

                nuevoItem.Calcular();
                var Inv = new InventarioBLL();
                //nuevoItem.ItemInventario=Inv.ObtenerXID(nuevoItem.ItemInventario.Catalogo.Id);
                saveItemInCarrito(nuevoItem);
                return(View("Carrito", Carrito.getCarrito()));
            }

            return(View("Carrito", Carrito.getCarrito()));
        }
        public ActionResult PrepararModificarItem(long ID)
        {
            if (this.IsAdminUserLoggedIn() == false)
            {
                return(View("AccesoDenegado"));
            }

            ViewBag.ModoOper = "EDIT";
            var Repo   = new CatalogoBLL();
            var auxObj = Repo.ObtenerXID(ID);

            return(View("CatalogoItem", auxObj));
        }
        public ActionResult EliminarItem(long ID)
        {
            if (this.IsAdminUserLoggedIn() == false)
            {
                return(View("AccesoDenegado"));
            }

            var Repo   = new CatalogoBLL();
            var auxObj = Repo.ObtenerXID(ID);

            Repo.Eliminar(auxObj);
            return(View("Catalogo"));
        }