public IHttpActionResult PutFilme(int id, Filme filme) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != filme.Id) { return(BadRequest()); } db.Entry(filme).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FilmeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "Id,Titulo,AnoLancamento,Duracao")] Filme filme) { if (ModelState.IsValid) { db.Filmes.Add(filme); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(filme)); }