コード例 #1
0
ファイル: UnderlyingFundNav.cs プロジェクト: jsingh/DeepBlue
        public override void Setup()
        {
            base.Setup();

            // Spin up mock repository and attach to controller
            MockService = new Mock<IUnderlyingFundNAVService>();

            DefaultUnderlyingFundNAV = new DeepBlue.Models.Entity.UnderlyingFundNAV(MockService.Object);
            MockService.Setup(x => x.SaveUnderlyingFundNAV(It.IsAny<DeepBlue.Models.Entity.UnderlyingFundNAV>()));
        }
コード例 #2
0
 public void SaveUnderlyingFundNAV(UnderlyingFundNAV underlyingFundNAV)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (underlyingFundNAV.UnderlyingFundNAVID == 0) {
             context.UnderlyingFundNAVs.AddObject(underlyingFundNAV);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("UnderlyingFundNAVs", underlyingFundNAV);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, underlyingFundNAV);
             }
         }
         context.SaveChanges();
     }
 }
コード例 #3
0
ファイル: UnderlyingFundNAV.cs プロジェクト: jsingh/DeepBlue
 private IEnumerable<ErrorInfo> Validate(UnderlyingFundNAV underlyingFundNAV)
 {
     return ValidationHelper.Validate(underlyingFundNAV);
 }