コード例 #1
0
    public static Expense ToModelToEntity(this ExpensesModel model)
    {
        var expense = new Expense{
           ListItemsExpense = model.ListItemsExpenseModel.Select(x=>x.ModelToEntity()).ToList()
        };
 
        return expense;
    }
コード例 #2
0
        public async Task<MonthFinanceModel> SaveMonthFinance([FromBody] MonthFinanceModel monthFinances)
        {
            var documents = (await monthFinanceConfPer.Get()).ToArray();
            var entity = documents.Where(x=> x.Name == monthFinances.Name).FirstOrDefault();
            
            if(entity.Name != null)
            {
                var entityExpense = new Expense {
                    ListItemsExpense = monthFinances.Expense.ListItemsExpenseModel.Select(x=>x.ModelToEntity())
                };

                var entityEarning = new Earning
                {
                    ListItemsEarning = monthFinances.Earning.ListItemsEarningModel.Select(x=>x.ModelToEntity())
                };
                    
                var entityInvestment = new Investment
                {
                    ListItemsInvestment = monthFinances.Investment.ListItemsInvestmentModel.Select(x=>x.ModelToEntity())  
                };

                entity.MonthEarning = entityEarning;
                entity.MonthExpense = entityExpense;
                entity.MonthInvestment = entityInvestment;

                await monthFinanceConfPer.Persist(entity);
            }    
            return entity.ToMonthFinanceModel();
        }
コード例 #3
0
 public MonthFinance(string name, Expense monthExpensiveLast, double saving)
 {
     this.Name = name;
     this.MonthExpense = monthExpensiveLast;
     this.Saving = saving;
 }