Example #1
0
 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     BookMap.Map(modelBuilder.Entity <Book>());
     AuthorMap.Map(modelBuilder.Entity <Author>());
     GenreMap.Map(modelBuilder.Entity <Genre>());
     StatusMap.Map(modelBuilder.Entity <Status>());
 }
Example #2
0
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            var category = new CategoryMap();
            var author   = new AuthorMap();
            var topic    = new TopicMap();

            _cryptographyConfiguration = new CryptographyConfiguration(
                new AesEncryptionProvider(new PassphraseKeyGenerator("SuperSecretPass", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })),
                new DefaultHmacProvider(new PassphraseKeyGenerator("UberSuperSecure", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 })));

            base.ApplicationStartup(container, pipelines);
        }
        public bool Add(ICRUDableEntity Entity)
        {
            var mapper    = AuthorMap.InitializeMapper();
            var authorDTO = mapper.Map <Models.Authors>(Entity);

            using (var context = new BookStoreContext())
            {
                context.Authors.Add(authorDTO);
                context.SaveChanges();
            }

            return(true);
        }