Пример #1
0
 public async Task RegisterNewBook()
 {
     document = new Document();
     document.Title = GetBookTitle();
     var language = GetBookLanguage();
     var book = await this.documentService.AddBook(document, language);
 }
 public async Task<Document> AddDocument(Document document, int documentPropertyId)
 {
     try
     {
         document.DocumentPropertyId = documentPropertyId;
         document.CreateDate = DateTime.Now;
         document.CreateUser = Constants.DefaultUser;
         var entity = this.ctx.Documents.Add(document);
         await this.ctx.SaveChangesAsync();
         return entity;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public async Task<Document> AddBook(Document book, string languageCode)
 {
     var propertyFactory = DocumentPropertiesFactory.SetDocumentProperties(Constants.DocumentType.Book);
     var property = await propertyFactory.SetProperties(this._documentDataService, languageCode);
     return await this._documentDataService.AddDocument(book, property.Id);
 }