コード例 #1
0
        public long Create(MovieEditDtoModel model)
        {
            var data = new Domain.Model.Movie();

            data.Title      = model.Title;
            data.Year       = model.Year;
            data.Released   = model.Released;
            data.Runtime    = model.Runtime;
            data.Genre      = model.Genre;
            data.Director   = model.Director;
            data.Writer     = model.Writer;
            data.Actors     = model.Actors;
            data.Language   = model.Language;
            data.Country    = model.Country;
            data.Poster     = model.Poster;
            data.ImdbRating = model.ImdbRating;

            Add(data);
            return(data.Id);
        }
コード例 #2
0
        public void Update(MovieEditDtoModel model)
        {
            var data = _context.Movies.FirstOrDefault(p => p.Title == model.Title);

            if (data == null)
            {
                return;
            }

            data.Year       = model.Year;
            data.Released   = model.Released;
            data.Runtime    = model.Runtime;
            data.Genre      = model.Genre;
            data.Director   = model.Director;
            data.Writer     = model.Writer;
            data.Actors     = model.Actors;
            data.Language   = model.Language;
            data.Country    = model.Country;
            data.Poster     = model.Poster;
            data.ImdbRating = model.ImdbRating;

            Edit(data);
        }