Skip to content

Instantly share code, notes, and snippets.

View Daniel-sims's full-sized avatar

Daniel-sims

  • Starling Bank
  • Remote
View GitHub Profile
@Daniel-sims
Daniel-sims / AuthenticationViewModel.kt
Last active October 16, 2022 17:19
Updating UI State with LoginSuccessful navigation event
private fun attemptLogin() {
viewModelScope.launch {
if (listOf(validateEmail(), validatePassword()).allValid()) {
uiState = uiState.copy(loading = true)
authenticationRepository.login(
email = uiState.content.email,
password = uiState.content.password
).handleResult(
onError = { loginError ->
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horiztonal">
<StackPanel.Resources>
<Style TargetType="Image">
<Setter Property="Width" Value="20"/>
</Style>
</StackPanel.Resources>
<Image />
<Image />
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace MCVE
{
class Program
{
static void Main(string[] args)
public IEnumerable<Models.DbMatch.Match> GetMatchesForListOfTeamIds(long usersChampionId, IEnumerable<int> teamOne, IEnumerable<int> teamTwo, int matchCount)
{
Console.WriteLine(DateTime.Now + " finding metches of users request.");
return _dbContext.Matches
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Runes)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Items)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.SummonerSpells)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Events)
.Where(q => q.Teams
.All(t =>
private ICollection<Models.DbMatch.PlayerItem> GetItemsForParticipant(RiotSharp.Endpoints.MatchEndpoint.Participant participant)
{
ICollection<Models.DbMatch.PlayerItem> items = new List<Models.DbMatch.PlayerItem>();
try
{
if (participant?.Stats?.Item0 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item0, ItemSlot = 0});
}
private ICollection<Models.DbMatch.PlayerItem> GetItemsForParticipant(RiotSharp.Endpoints.MatchEndpoint.Participant participant)
{
ICollection<Models.DbMatch.PlayerItem> items = new List<Models.DbMatch.PlayerItem>();
try
{
if (participant?.Stats?.Item0 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item0, ItemSlot = 0});
}