public async Task <ActionResult> Delete(int id)
        {
            var peliculaDB = await context.Peliculas.FirstOrDefaultAsync(x => x.Id == id);

            if (peliculaDB.Poster != null)
            {
                await almacenador.BorrarArchivo(contenedor, peliculaDB.Poster);
            }

            context.Remove(peliculaDB);
            await context.SaveChangesAsync();

            return(NoContent());
        }
Beispiel #2
0
        public async Task <ActionResult> Delete(int id)
        {
            var actorDB = await context.Actores.FirstOrDefaultAsync(x => x.Id == id);

            if (actorDB.Foto != null)
            {
                await almacenadorArchivos.BorrarArchivo(contenedor, actorDB.Foto);
            }

            context.Remove(actorDB);
            await context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult> Delete(int id)
        {
            var pelicula = await context.Peliculas.FirstOrDefaultAsync(x => x.Id == id);

            if (pelicula == null)
            {
                return(NotFound());
            }
            context.Remove(pelicula);
            await context.SaveChangesAsync();

            await almacenadorArchivos.BorrarArchivo(pelicula.Poster, contenedor); // borra la foto

            return(NoContent());
        }
        public async Task <ActionResult> Delete(int id)
        {
            var actor = await context.Actores.FirstOrDefaultAsync(x => x.Id == id);

            if (actor == null)
            {
                return(NotFound());
            }
            context.Remove(actor);
            await context.SaveChangesAsync();

            await almacenadorArchivos.BorrarArchivo(actor.Foto, contenedor); // borra la foto

            return(NoContent());
        }
Beispiel #5
0
        public async Task <ActionResult> Delete(int id)
        {
            var serie = await context.Series.FirstOrDefaultAsync(x => x.Id == id);

            if (serie is null)
            {
                return(NotFound());
            }

            context.Remove(serie);
            await context.SaveChangesAsync();

            await almacenadorArchivos.BorrarArchivo(serie.Imagen, contenedor);

            return(NoContent());
        }
        public async Task <ActionResult> Delete(int id)
        {
            //var existe = await context.Actores.AnyAsync(x => x.Id == id);

            var actor = await context.Actores.FirstOrDefaultAsync(x => x.Id == id);

            if (actor == null)
            {
                return(NotFound());
            }

            context.Remove(actor);
            await context.SaveChangesAsync();

            //Borramos la foto del actor desde azure storage
            await almacenadorArchivos.BorrarArchivo(actor.Foto, contenedor);

            return(NoContent());
        }
Beispiel #7
0
        public async Task <ActionResult> Delete(int id)
        {
            Actor actorEncontrado;

            actorEncontrado = await context.Actores.FirstOrDefaultAsync(x => x.Id == id);

            if (actorEncontrado == null)
            {
                return(NotFound());
            }

            if (actorEncontrado.Foto != null)
            {
                await almacenadorArchivos.BorrarArchivo(actorEncontrado.Foto, CONTENEDOR);
            }

            context.Actores.Remove(actorEncontrado);
            await context.SaveChangesAsync();

            return(NoContent());
        }