private async Task GetQuoteAsync(CommandContext ctx, GoTCharacter character) { JObject result = await gotQuoteAPI.Request(character.Term); string quote = (string)result["quote"]; await ctx.RespondAsync($"\"{quote}\" - {character.Name}"); }
public async Task RandomAsync(CommandContext ctx) { await ctx.TriggerTypingAsync(); GoTCharacter character = GoTCharacter.Characters[Tyrion.Random.Next(GoTCharacter.Characters.Length)]; await GetQuoteAsync(ctx, character); }
public void AddCharacter(string name, bool isAlive, bool isLikeable) { var character = new GoTCharacter { Name = name, IsAlive = isAlive, IsLikeable = isLikeable }; GoTCharacterContext.GoTCharacters.Add(character); GoTCharacterContext.SaveChanges(); }
public void UpdateCharacter(GoTCharacter goTCharacter) { GoTCharacterContext.GoTCharacters.Update(goTCharacter); GoTCharacterContext.SaveChanges(); }
public IActionResult Update(GoTCharacter goTCharacter) { GoTCharacterRepository.UpdateCharacter(goTCharacter); return(RedirectToAction("List")); }