public RunningActionViewModel(UserAction userAction, UserActionContext userActionContext = null) { this.UserAction = userAction; this.UserActionContext = userActionContext; RegisterCommands(); SetupActionForRun(); }
public UserActionDisplayModel(UserAction userAction, UserActionContext actionContext) { this.ID = userAction.ID; this.Date = userAction.Date; this.StartTime = userAction.StartTime; this.EndTime = userAction.EndTime; this.Title = userAction.Title; this.Status = userAction.Status; this.ActionContext = actionContext; }
public Task <int> CreateOrUpdateActionContextAsync(UserActionContext actionContext) { if (actionContext.ID == 0) { return(_database.InsertAsync(actionContext)); } else { return(_database.UpdateAsync(actionContext)); } }
private async Task LoadData() { foreach (var item in await App.Database.GetActionContextsAsync()) { ActionContextList.Add(item); } Context = ActionContextList .Where(c => c.ID == UserAction.UserActionContextId) .FirstOrDefault(); }
async void OnAddNewActionContextButtonClicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(NewActionContextName.Text)) { await DisplayAlert("", "You can't add empty context", "Cancel"); return; } var actionContext = new UserActionContext() { Title = NewActionContextName.Text }; await App.Database.CreateOrUpdateActionContextAsync(actionContext); // Clear editor NewActionContextName.Text = string.Empty; UpdateActivityContextList(); }
public Task <int> DeleteActionContextAsync(UserActionContext actionContext) { return(_database.DeleteAsync <UserActionContext>(actionContext.ID)); }