private async Task <IEnumerable <MonthlyPlan> > CreatePlanAsync(Bundle bundle) { var allGoals = await repository.AllAsync(); if (bundle != null) { var selected = bundle.GetStringArray(AppConstant.SelectedGoals); if (selected.Any()) { allGoals = allGoals.Where(g => bundle.GetStringArray(AppConstant.SelectedGoals).Contains(g.Id.ToString())); } } var planFactory = new PlanFactory(allGoals, new DebugLogger()); return(planFactory.CreatePlan()); }
public override void Execute() { try { _plan = PlanFactory.CreatePlan(GetPlanType(), ExecuteDate, NameFormatter, _args); if (!ChooseName()) { return; } _plan.Name = Name; _plan.Details = Details; IPlanManager _planManager = ManagerFactory.GetPlanManager(_plan); _planManager.CreatePlan(_plan); AddMessage("Save successed!", MessageType.Success); } catch (Exception ex) { AddMessage(ex.Message, MessageType.Error); } }