Beispiel #1
0
        public ActionResult AgregarItem([FromBody] DTOCatalogoItem auxDTO)
        {
            if (!ModelState.IsValid)
            {
                return(View("Error", "Error en datos!"));
            }

            if (this.IsAdminUserLoggedIn() == false)
            {
                return(View("AccesoDenegado"));
            }

            var Rnd  = new Random();
            var Repo = new CatalogoBLL();

            //auxDTO.Item.Rubro=Helper.GetListaRubros().First(x => x.Id == auxDTO.Item.RubroId);

            if (auxDTO.Foto != null)
            {
                var NombreArch = auxDTO.Foto.PathFoto;

                //String PathGuardar = Path.Combine(_env, "~/Fotos/") + NombreArch;
                //auxDTO.Foto.PathFoto = PathGuardar;
                auxDTO.Foto.PathFoto = NombreArch;
                auxDTO.Item.Foto     = auxDTO.Foto.PathFoto;
            }

            Repo.Agregar(auxDTO);

            return(View("Catalogo"));
        }
Beispiel #2
0
        public ActionResult ModificarItem([FromBody] DTOCatalogoItem auxDTO)
        {
            if (!ModelState.IsValid)
            {
                return(View("Error", "Error en datos!"));
            }

            if (this.IsAdminUserLoggedIn() == false)
            {
                return(View("AccesoDenegado"));
            }

            var Repo = new CatalogoBLL();

            Repo.Modificar(auxDTO);

            //TODO:Reemplazar la foto existente en el servidor


            return(View("Catalogo"));
        }
Beispiel #3
0
 public void Modificar(DTOCatalogoItem auxDTO)
 {
     this.CapaDatos.Modificar(auxDTO.Item);
     GuardarFoto(auxDTO.Foto);
 }
Beispiel #4
0
 public void Agregar(DTOCatalogoItem auxDTO)
 {
     this.CapaDatos.Agregar(auxDTO.Item);
     GuardarFoto(auxDTO.Foto);
 }