public GoalPage(Model.Goal model, int id) { InitializeComponent(); viewModel = new ViewModel.GoalViewModel(model); Content.BindingContext = viewModel; this.id = id; }
private async void OnItemTapped(object sender, ItemTappedEventArgs e) { Model.Goal temp = (Model.Goal)listView.SelectedItem; await Navigation.PushAsync(new GoalPage((Model.Goal)e.Item, temp.Id)); listView.SelectedItem = null; }
public GoalViewModel(Model.Goal model) { goal = model; OnAddCommand = new Command(OnAdd); OnSaveCommand = new Command(OnSave); OnUpdateCommand = new Command(OnUpdate); OnDeleteCommand = new Command(OnDelete); }
public GoalViewModel() { FillListGoalsAsync(); goal = new Model.Goal(); OnAddCommand = new Command(OnAdd); OnSaveCommand = new Command(OnSave); OnUpdateCommand = new Command(OnUpdate); }
private void OnAdd() { goal = new Model.Goal(); ShortName = string.Empty; Description = string.Empty; ReachOn = DateTime.Today; Enable = false; }
public Model.Goal Delete(int id) { //Collect the SQL and call string sql = base.LoadSqlResources().Values.First(); Dictionary <string, object> parameters = ConvertToParameters(new { Id = id }); Model.Goal removedGoal = typedDataAccess.ExecuteQuery <Model.Goal>(sql, parameters).First(); return(removedGoal); }
public Model.Goal GetGoal(int goalID) { //Collect the SQL and call string sql = base.LoadSqlResources().Values.FirstOrDefault(); Dictionary <string, object> parameters = ConvertToParameters(new { Id = goalID }); //Load the goal Model.Goal goal = typedDataAccess.ExecuteQuery <Model.Goal>(sql, parameters).FirstOrDefault(); return(goal); }
public Model.Goal UpdateGoal(int goalId, Model.Goal goal) { string sql = base.LoadSqlResources().Values.First(); Dictionary <string, object> parameters = ConvertToParameters ( new { Id = goalId, goal.Name, goal.Description, goal.Target, StatusId = GoalStatus.Open, goal.IsDefault } ); //Update and return return(typedDataAccess.ExecuteQuery <Model.Goal>(sql, parameters).First()); }
public Model.Goal CreateGoalForUser(int userID, Model.Goal goal) { string sql = base.LoadSqlResources().Values.First(); Dictionary <string, object> parameters = ConvertToParameters ( new { UserId = userID, goal.Name, goal.Description, goal.Target, StatusId = GoalStatus.Open, goal.IsDefault } ); //Execute and return the goal Model.Goal savedGoal = typedDataAccess.ExecuteQuery <Model.Goal>(sql, parameters).First(); return(savedGoal); }
public int UpdateItem(Model.Goal goal) { return(database.Update(goal)); }
public int SaveItem(Model.Goal item) { return(database.Insert(item)); }