public async Task <Pelicula> Post(Pelicula pelicula) { if (pelicula.Id == 0) { return(await _peliculaService.Create(pelicula)); } else { return(await _peliculaService.Update(pelicula)); } }
public IHttpActionResult PutPelicula(long id, Pelicula pelicula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pelicula.Id) { return(BadRequest()); } peliculaService.Update(id, pelicula); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutPelicula(long id, Pelicula pelicula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pelicula.Id) { return(BadRequest()); } try { peliculasService.Update(pelicula); } catch (NoEncontradoException) { return(NotFound()); } return(StatusCode(HttpStatusCode.NoContent)); }