private async Task PrepareView() { this.gameForm = new GameFormModel(); this.gameId = this.Router.GetQueryParam("gameId"); this.categories = await this.CategoryService.GetCategoryNames(); if (this.Action.ToLower() == "edit" && !string.IsNullOrWhiteSpace(this.gameId)) { this.gameForm = await this.GameService.GetGame(this.gameId); } this.StateHasChanged(); }
public async Task EditGame(string gameId, GameFormModel game) { await this.httpClient.PutAsync <string>(this.gamesUrl + gameId, game); }
public async Task AddGame(GameFormModel game) { await this.httpClient.PostAsync <string>(this.gamesUrl, game); }
protected override async Task OnInitializedAsync() { this.gameForm = await this.GameService.GetGame(this.GameId); }