コード例 #1
0
 public async Task<DocumentProperty> AddDocumentProperties(DocumentProperty property)
 {
     try
     {
         var entity = this.ctx.DocumentProperties.Add(property);
         await this.ctx.SaveChangesAsync();
         return entity;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #2
0
        public async Task<DocumentProperty> SetProperties(IDocumentDataService documentDataService, string languageCode)
        {
            var documentTypeId = await documentDataService.GetDocumentTypeIdByCode(Constants.DocumentType.Book);
            var languageId = await documentDataService.GetLanguageIdByCode(languageCode);
            var property = new DocumentProperty()
            {
                CanBeLent = true,
                MaxDaysRent = Constants.BooksPropertyForLoan.LoanDays,
                TypeId = documentTypeId,
                FinePrice = Constants.BooksPropertyForLoan.FineValue,
                LanguageId = languageId,
                CreateUser = Constants.DefaultUser,
                CreateDate = DateTime.Now
            };

            return await documentDataService.AddDocumentProperties(property);
        }