예제 #1
0
        public void AddPrintingEdition(PrintingEditionModel printingEdition)
        {
            _validator.ValidatePrintingEdition(printingEdition);
            var dbPrintingEdition = _mapper.Map <PrintingEditionEntity>(printingEdition);

            dbPrintingEdition.Status = Enums.PrintingEditionStatusType.InStock;
            var authorFilter = new AuthorFilterModel {
                EditionAuthors = printingEdition.Authors
            };
            var authors = _authorRepository.GetAll(authorFilter);

            dbPrintingEdition.Authors = new List <AuthorEntity>(authors);
            _printingEditionRepository.Insert(dbPrintingEdition);
        }