Пример #1
0
        /// <summary>
        /// Mapper method to convert new Budget Income Model to db income entity
        /// Does not map income id
        /// </summary>
        /// <param name="incomeModel"></param>
        /// <returns>Budget Income Entity </returns>
        public static DbIncomeEntity CoreModelToDbEntityNew(CoreIncomeModel incomeModel)
        {
            DbIncomeEntity dbEntity = new DbIncomeEntity()
            {
                UserId       = incomeModel.UserId,
                IncomeAmount = incomeModel.Amount,
                IncomeType   = incomeModel.IncomeType
            };

            return(dbEntity);
        }
Пример #2
0
        /// <summary>
        /// Mapper method to convert existing Budget income model to db income entity
        /// Maps income id
        /// </summary>
        /// <param name="incomeModel"></param>
        /// <returns>Budget Income Entity</returns>
        public static DbIncomeEntity CoreModelToDbEntityExisting(CoreIncomeModel incomeModel)
        {
            DbIncomeEntity dbEntity = new DbIncomeEntity()
            {
                Id           = incomeModel.Id,
                UserId       = incomeModel.UserId,
                IncomeType   = incomeModel.IncomeType,
                IncomeAmount = incomeModel.Amount
            };

            return(dbEntity);
        }
Пример #3
0
        /// <summary>
        /// Mapper method to convert database income entity to core income model
        /// </summary>
        /// <param name="incomeEntity"></param>
        /// <returns>Budget Income Model Object</returns>
        public static CoreIncomeModel DbEntityToCoreModel(DbIncomeEntity incomeEntity)
        {
            CoreIncomeModel coreModel = new CoreIncomeModel()
            {
                Id         = incomeEntity.Id,
                Amount     = incomeEntity.IncomeAmount,
                IncomeType = incomeEntity.IncomeType,
                UserId     = incomeEntity.UserId
            };

            return(coreModel);
        }