public PlannedExpenseViewModel() { PlannedexpRep = new PlannedExpenseRepository(); catRep = new CategoryRepository(); CategoryList = new ObservableCollection <Category>(); Repeatability = new ObservableCollection <String>(); var iList = catRep.GetCategoriesAsync(); foreach (Category i in iList.Result) { CategoryList.Add(i); } Repeatability.Add("Codziennie"); Repeatability.Add("Co tydzień"); Repeatability.Add("Co miesiąc"); SavePlannedExpenseCommand = new Command(async() => { var plannedExpense = new PlannedExpense(); plannedExpense.Description = TheDescription; plannedExpense.Value = Convert.ToDouble(TheValue); plannedExpense.StartDate = TheStartDate; plannedExpense.NextExpenseDate = TheStartDate; plannedExpense.EndDate = TheEndDate; plannedExpense.CategoryId = CategoryId + 1; plannedExpense.Repeatability = RepeatabilityId + 1; await PlannedexpRep.SavePlannedExpAsync(plannedExpense); TheDescription = string.Empty; TheValue = "0"; CategoryId = -1; }); }
public PlannedExpenseListViewModel() { PlannedexpRep = new PlannedExpenseRepository(); }