Пример #1
0
        public bool CreateMovie(MovieCreate model)
        {
            var entity = new Movie()
            {
                Title = model.Title
            };

            using (var ctx = new ClassesDbContext())
            {
                ctx.Movies.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #2
0
        public bool CreateCharacterMovie(CharacterMovieCreate model)
        {
            var entity = new CharacterMovie()
            {
                CharacterId = model.CharacterId,
                MovieId     = model.MovieId
            };

            using (var ctx = new ClassesDbContext())
            {
                ctx.CharacterMovies.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #3
0
        public bool CreateCharacter(CharacterCreate model)
        {
            var entity = new Character()
            {
                RealName = model.RealName,
                AlterEgo = model.AlterEgo
            };

            using (var ctx = new ClassesDbContext())
            {
                ctx.Characters.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }