Example #1
0
        public Movie Post(Movie movie)
        {
            if (Movies.Any())
                movie.Id = Movies.Max(m => m.Id) + 1;
            else
                movie.Id = 1;
            Movies.Add(movie);

            return movie;
        }
Example #2
0
        public Movie Put(Movie Movie)
        {
            var m = Get(Movie.Id);

            if (m == null)
                throw new Exception(string.Format("Movie with id {0} not exists.", Movie.Id));

            m.Actors = Movie.Actors;
            m.Directors = Movie.Directors;
            m.Poster = Movie.Poster;
            m.Rate = Movie.Rate;
            m.ReleaseYear = Movie.ReleaseYear;
            m.Synopsis = Movie.Synopsis;
            m.Title = Movie.Title;
            return m;
        }