Esempio n. 1
0
 public void Edit(Movie movie)
 {
     var original = this.FindMovie(movie.Id);
     original.Title = movie.Title;
     original.Director = movie.Director;
     _db.SaveChanges();
 }
Esempio n. 2
0
        public void EditMovie(Movie movie)
        {
            var original = _repo.Find<Movie>(movie.Id);
            original.Title = movie.Title;
            original.Director = movie.Director;
            _repo.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);
            }
        }
Esempio n. 4
0
 public void AddMovie(Movie movie)
 {
     _repo.Add(movie);
     _repo.SaveChanges();
 }
Esempio n. 5
0
 public void Insert(Movie movie)
 {
     _db.Movies.Add(movie);
     _db.SaveChanges();
 }