Beispiel #1
0
 public bool UpdateBuyAndHoldMerger(BuyAndHoldMergerDto dto)
 {
     var db = new InvestContext();
     var model = db.BuyAndHoldMergers.FirstOrDefault(p => p.Id == dto.Id);
     model.TransactionDate = dto.TransactionDate;
     model.BuyAndHoldTransactionId_In = dto.BuyAndHoldTransactionId_In;
     model.TickerSymbol_In = dto.TickerSymbol_In;
     model.SecurityId_In = dto.SecurityId_In;
     model.Type_In = dto.Type_In;
     model.AmountInvested_In = dto.AmountInvested_In;
     model.NumberShares_In = dto.NumberShares_In;
     model.BuyPrice_In = dto.BuyPrice_In;
     model.BuyAndHoldTransactionId_Out = dto.BuyAndHoldTransactionId_Out;
     model.TickerSymbol_Out = dto.TickerSymbol_Out;
     model.SecurityId_Out = dto.SecurityId_Out;
     model.Type_Out = dto.Type_Out;
     model.AmountInvested_Out = dto.AmountInvested_Out;
     model.NumberShares_Out = dto.NumberShares_Out;
     model.BuyPrice_Out = dto.BuyPrice_Out;
     model.TransactionApplied = dto.TransactionApplied;
     model.ExchangeRate = dto.ExchangeRate;
     model.Notes = dto.Notes;
     model.Url1 = dto.Url1;
     model.Url2 = dto.Url2;
     model.Url3 = dto.Url3;
     db.SaveChanges();
     return true;
 }
Beispiel #2
0
 public bool UpdateBuyAndHoldMerger(BuyAndHoldMergerDto dto)
 {
     return _buyAndHoldManager.UpdateBuyAndHoldMerger(dto);
 }
Beispiel #3
0
 public bool UpdateTransaction(BuyAndHoldMergerDto dto)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
        //private BuyAndHoldTransactionDto MapBuyAndHoldTransaction(BuyAndHoldTransaction buyAndHoldTransactionModel)
        //{
        //    var dto = new BuyAndHoldTransactionDto
        //    {
        //        Id = buyAndHoldTransactionModel.Id,
        //        BuyAndHoldRawId = buyAndHoldTransactionModel.RawTransactionId,
        //        OriginalTransactionId = buyAndHoldTransactionModel.OriginalTransactionId,
        //        TransactionDate = buyAndHoldTransactionModel.TransactionDate,
        //        TickerSymbol = buyAndHoldTransactionModel.TickerSymbol,
        //        SecurityId = buyAndHoldTransactionModel.SecurityId,
        //        OriginalTickerSymbol = buyAndHoldTransactionModel.OriginalTickerSymbol,
        //        OriginalSecurityId = buyAndHoldTransactionModel.OriginalSecurityId,
        //        Period = buyAndHoldTransactionModel.Period,
        //        TransactionTypeId = buyAndHoldTransactionModel.TransactionTypeId,
        //        TransactionApplied = buyAndHoldTransactionModel.TransactionApplied ?? false,
        //        DividendAmount = buyAndHoldTransactionModel.DividendAmount,
        //        AmountInvested = buyAndHoldTransactionModel.AmountInvested,
        //        NumberShares = buyAndHoldTransactionModel.NumberShares,
        //        BuyPrice = buyAndHoldTransactionModel.BuyPrice,
        //        Split = buyAndHoldTransactionModel.Split,
        //        ValidFrom = buyAndHoldTransactionModel.ValidFrom,
        //        ValidTo = buyAndHoldTransactionModel.ValidTo,
        //        SellDate = buyAndHoldTransactionModel.SellDate,
        //        SellId = buyAndHoldTransactionModel.SellId,
        //        Notes = buyAndHoldTransactionModel.Notes,
        //        TransactionType = buyAndHoldTransactionModel.BuyAndHoldTransactionType.Type,
        //    };
        //    if (buyAndHoldTransactionModel.OriginalTransaction != null)
        //    {
        //        dto.OriginalTransaction = MapBuyAndHoldTransaction(buyAndHoldTransactionModel.OriginalTransaction);
        //        if (!buyAndHoldTransactionModel.BuyPrice.HasValue)
        //        {
        //            dto.BuyPrice = buyAndHoldTransactionModel.OriginalTransaction.BuyPrice;
        //        }
        //        if (!buyAndHoldTransactionModel.NumberShares.HasValue)
        //        {
        //            dto.NumberShares = buyAndHoldTransactionModel.OriginalTransaction.NumberShares;
        //        }
        //    }
        //    return dto;
        //}
        private BuyAndHoldMergerDto MapBuyAndHoldMerger(BuyAndHoldMerger model)
        {
            var dto = new BuyAndHoldMergerDto
            {
                Id = model.Id,
                TransactionDate = model.TransactionDate,
                BuyAndHoldTransactionId_In = model.BuyAndHoldTransactionId_In,
                TickerSymbol_In = model.TickerSymbol_In,
                SecurityId_In = model.SecurityId_In,
                Type_In = model.Type_In,
                AmountInvested_In = model.AmountInvested_In,
                NumberShares_In = model.NumberShares_In,
                BuyPrice_In = model.BuyPrice_In,
                BuyAndHoldTransactionId_Out = model.BuyAndHoldTransactionId_Out,
                TickerSymbol_Out = model.TickerSymbol_Out,
                SecurityId_Out = model.SecurityId_Out,
                Type_Out = model.Type_Out,
                AmountInvested_Out = model.AmountInvested_Out,
                NumberShares_Out = model.NumberShares_Out,
                BuyPrice_Out = model.BuyPrice_Out,
                TransactionApplied = model.TransactionApplied,
                ExchangeRate = model.ExchangeRate,
                Notes = model.Notes,
                Url1 = model.Url1,
                Url2 = model.Url2,
                Url3 = model.Url3
            };

            return dto;
        }
        private BuyAndHoldMergerViewModel MapMergerDtoToViewModel(BuyAndHoldMergerDto dto)
        {
            var model = new BuyAndHoldMergerViewModel
            {
                Id = dto.Id,
                TransactionDate = dto.TransactionDate,
                BuyAndHoldTransactionId_In = dto.BuyAndHoldTransactionId_In,
                TickerSymbol_In = dto.TickerSymbol_In,
                SecurityId_In = dto.SecurityId_In,
                Type_In = dto.Type_In,
                AmountInvested_In = dto.AmountInvested_In,
                NumberShares_In = dto.NumberShares_In,
                BuyPrice_In = dto.BuyPrice_In,
                BuyAndHoldTransactionId_Out = dto.BuyAndHoldTransactionId_Out,
                TickerSymbol_Out = dto.TickerSymbol_Out,
                SecurityId_Out = dto.SecurityId_Out,
                Type_Out = dto.Type_Out,
                AmountInvested_Out = dto.AmountInvested_Out,
                NumberShares_Out = dto.NumberShares_Out,
                BuyPrice_Out = dto.BuyPrice_Out,
                TransactionApplied = dto.TransactionApplied,
                ExchangeRate = dto.ExchangeRate,
                Notes = dto.Notes,
                Url1 = dto.Url1,
                Url2 = dto.Url2,
                Url3 = dto.Url3
            };

            return model;
        }