public async Task <ActionResult <Pelicula> > Create([FromBody] Pelicula pelicula) { logger.LogInformation($"Nueva pelicula en cartelera"); await peliculaService.Create(pelicula); return(CreatedAtAction("Nueva pelicula", new { id = pelicula.Id }, pelicula)); }
public IHttpActionResult PostPelicula(Pelicula Pelicula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Pelicula = PeliculaService.Create(Pelicula); return(CreatedAtRoute("DefaultApi", new { id = Pelicula.Id }, Pelicula)); }
public IHttpActionResult PostUsuario(Pelicula pelicula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } pelicula = peliculaService.Create(pelicula); return(CreatedAtRoute("DefaultApi", new { id = pelicula.Id }, pelicula)); }
public async Task <Pelicula> Post(Pelicula pelicula) { if (pelicula.Id == 0) { return(await _peliculaService.Create(pelicula)); } else { return(await _peliculaService.Update(pelicula)); } }