Example #1
0
        public static IList <MonthlyPlanViewModel> Map(this IList <MonthlyBudget> monthlyBudgets)
        {
            IList <MonthlyPlanViewModel> viewModels = new List <MonthlyPlanViewModel>();

            if (monthlyBudgets != null && monthlyBudgets.Count > 0)
            {
                foreach (MonthlyBudget mb in monthlyBudgets)
                {
                    MonthlyPlanViewModel model = mb.MapToViewModel();
                    if (model != null)
                    {
                        viewModels.Add(model);
                    }
                }
            }

            return(viewModels);
        }
Example #2
0
        public static MonthlyBudget MapToModel(this MonthlyPlanViewModel monthlyPlanVM)
        {
            MonthlyBudget budget = null;

            if (monthlyPlanVM != null)
            {
                budget = new MonthlyBudget()
                {
                    BaseBudget     = monthlyPlanVM.BudgetForAllocation,
                    Comments       = monthlyPlanVM.Comments,
                    MonthName      = monthlyPlanVM.MonthName,
                    Id             = monthlyPlanVM.MonthlyBudgetId,
                    AnnualBudgetId = monthlyPlanVM.AnnualBudgetId,
                    LastModifited  = monthlyPlanVM.LastModified,
                    CreationDate   = monthlyPlanVM.CreationDate
                };
            }
            return(budget);
        }