public IHttpActionResult Putmovies(int id, visning movies) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != movies.id) { return(BadRequest()); } db.Entry(movies).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!moviesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getmovies(int id) { visning movies = db.visnings.Find(id); if (movies == null) { return(NotFound()); } return(Ok(movies)); }
public IHttpActionResult Postmovies(visning movies) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.visnings.Add(movies); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = movies.id }, movies)); }
public IHttpActionResult Deletemovies(int id) { visning movies = db.visnings.Find(id); if (movies == null) { return(NotFound()); } db.visnings.Remove(movies); db.SaveChanges(); return(Ok(movies)); }