コード例 #1
0
ファイル: Expense.cs プロジェクト: rpanasewicz/iCBM
        }                     // For EF

        private Expense(Guid id, string name, string description, Money amount, DateTime expenseTime, Supplier supplier, Category category, ConstructionStage constructionStage)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
            }
            if (string.IsNullOrWhiteSpace(description))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(description));
            }

            Id                  = id;
            Name                = name;
            Description         = description;
            Amount              = amount ?? throw new ArgumentNullException(nameof(amount));
            ExpenseTime         = expenseTime;
            Supplier            = supplier;
            ConstructionStage   = constructionStage ?? throw new ArgumentNullException(nameof(constructionStage));
            Category            = category ?? throw new ArgumentNullException(nameof(category));
            CategoryId          = category.Id;
            SupplierId          = supplier?.Id;
            ConstructionStageId = constructionStage.Id;
        }
コード例 #2
0
ファイル: Expense.cs プロジェクト: rpanasewicz/iCBM
 public static Expense New(string name, string description, Money amount, DateTime expenseTime, Supplier supplier, Category category, ConstructionStage constructionStage)
 {
     return(new Expense(Guid.NewGuid(), name, description, amount, expenseTime, supplier, category, constructionStage));
 }