public void EditMovie(Movie movie) { var original = _repo.Find<Movie>(movie.Id); original.Title = movie.Title; original.Director = movie.Director; _repo.SaveChanges(); }
public void Edit(Movie movie) { var original = this.FindMovie(movie.Id); original.Title = movie.Title; original.Director = movie.Director; _db.SaveChanges(); }
public IHttpActionResult Post(Movie movie) { if (movie == null) { return BadRequest("Missing movie."); } if (!ModelState.IsValid) { return BadRequest(ModelState); } if (movie.Id == 0) { _movieService.AddMovie(movie); return Created("/movies/" + movie.Id, movie); } else { _movieService.EditMovie(movie); return Ok(movie); } }
public void AddMovie(Movie movie) { _repo.Add(movie); _repo.SaveChanges(); }
public void Insert(Movie movie) { _db.Movies.Add(movie); _db.SaveChanges(); }