コード例 #1
0
        public void RemoveSiteRate(SiteRate rate)
        {
            //TODO: Implement rules to make sure Aggregate root is always in valid state
            var index = _rates.FindIndex(x => x.AgeCode == rate.AgeCode);

            if (index == -1)
            {
                throw new InvalidOperationException($"Rate with Age code {rate.AgeCode} not found for Site {this.SiteNumber}");
            }

            _rates.RemoveAt(index);
            var dbRate = DbState.SiteRate.First(x => x.AgeCode == rate.AgeCode);

            DbState.SiteRate.Remove(dbRate);
        }
コード例 #2
0
 public void AddNewSiteRate(SiteRate rate)
 {
     //TODO: Implement rules to make sure Aggregate root is always in valid state
     _rates.Add(rate);
     DbState.SiteRate.Add(rate.DbState);
 }