Esempio n. 1
0
 public Expenses ConvertDtoToExpenses(ExpensesDto exp)
 {
     return(new Expenses()
     {
         ExpensesId = exp.Id,
         Expenditure = exp.AmountOfMoney,
         CurrencyType = exp.Currency,
         Comment = exp.Comment,
         ExpensesType = exp.ExpensesType,
         СostsDate = exp.DateOfOperation,
         UserId = Guid.Parse("a4debc71-7754-4d36-8613-994792d54f61") // TODO Установить передачу айди
     });
 }
        private List <IBusinessObject> ConvertCollToBO(List <DtoObject> newColl)
        {
            List <IBusinessObject> lstDtoItems = new List <IBusinessObject>();

            foreach (DtoObject item in newColl)
            {
                if (item is ExpensesDto)
                {
                    ExpensesDto  dto    = (ExpensesDto)item;
                    ExpensesInfo newExp = new ExpensesInfo(dto.Id,
                                                           MoneyWorker.ChangeCurrency(dto.AmountOfMoney,
                                                                                      Enum.Parse(typeof(ExchangeRateEnum), ((ExchangeRateEnum)dto.Currency).ToString()).ToString(),
                                                                                      DefaultValuesForControllers.Instance.DefaultExchangeRate,
                                                                                      DefaultValuesForControllers.Instance.DefaultDecimals),
                                                           dto.Comment, dto.DateOfOperation, (ExpensesType)dto.ExpensesType);
                    lstDtoItems.Add(newExp);
                }
            }
            return(lstDtoItems);
        }