Ejemplo n.º 1
0
        public void TestEntityCreate()
        {
            var pub = PublicationBuilder.New().Build();

            var mockTeste = new Mock <ICreateDB <Publication> >();

            var publicationRepository = new PublicationRepository(mockTeste.Object);

            publicationRepository.Create(pub);

            mockTeste.Verify(x => x.CreateNewRegister(It.IsAny <Publication>()));
        }
Ejemplo n.º 2
0
        public void Create(PublicationViewModel publicationViewModel, HttpPostedFileBase uploadImage)
        {
            var publication = Mapper.Map <PublicationViewModel, Publication>(publicationViewModel);

            publication.Type = LibraryType.Publications;

            IEnumerable <Author> authors = _authorRepository.GetAll();

            publication.AuthorName = authors.FirstOrDefault(x => x.AuthorId == publication.AuthorId)?.AuthorName;

            IEnumerable <Redaction> redactions = _redactionRepository.GetAll();

            publication.RedactionName = redactions.FirstOrDefault(x => x.RedactionId == publication.RedactionId)?.RedactionName;

            byte[] imageData = _imageHelper.GetImage(uploadImage);

            publication.Image = imageData;

            _publicationRepository.Create(publication);
        }
Ejemplo n.º 3
0
        public /*async*/ void Create(GetPublicationView publicationView)
        {
            var publication = Mapper.Map <GetPublicationView, Publication>(publicationView);

            /*await*/ publicationRepository.Create(publication);
        }