Exemplo n.º 1
0
        public static Deposits CreateDeposit(INewDeposit depositModel, string userId, byte termsId, string cardId)
        {
            var dbContext = DepositEntitiesExtension.GetInstance();
            var depositTerms = DepositTermsData.GetTermsById(termsId);

            var newDeposit = new Deposits()
            {
                UserOwnerId = userId,
                InitialAmount = depositModel.Amount,
                StartDate = DateTime.Now,
                EndDate = DateTime.Now.AddMonths(depositTerms.Months),
                Balance = Convert.ToDecimal(depositModel.Amount),
                DepositWaysOfAccumulation = DepositWaysOfAccumulationData.GetWayById(depositModel.WayOfAccumulationId),
                Cards = CardsData.GetCardById(cardId),
                DepositTerms = depositTerms,
                DepositStates = DepositStatesData.GetStateByName("Opened")
            };

            return newDeposit;
        }
Exemplo n.º 2
0
        public DomainLogic.Model.Deposits CreateNewDeposit(decimal depositAmount, byte wayOfAccumulationId, string userId, byte termsId, string cardId)
        {
            var depositTerms = DepositTermsData.GetTermsById(termsId);

            var newDeposit = new Deposits()
            {
                UserOwnerId = userId,
                InitialAmount = depositAmount,
                StartDate = DateTime.Now,
                EndDate = DateTime.Now.AddMonths(depositTerms.Months),
                Balance = depositAmount,
                DepositWaysOfAccumulation = DepositWaysOfAccumulationData.GetWayById(wayOfAccumulationId),
                Cards = CardsData.GetCardById(cardId),
                DepositTerms = depositTerms,
                DepositStates = DepositStatesData.GetStateByName("Opened")
            };

            DepositsData.AddNewDepositToDbContext(newDeposit);

            return newDeposit.ToDomainLogic();
        }
Exemplo n.º 3
0
 public static void AddNewDepositToDbContext(Deposits newDeposit)
 {
     DepositEntitiesExtension.GetInstance().Deposits.Add(newDeposit);
 }