I have the following model of the claim one player makes on another player after winning a bet:
public class Claim : BaseMovement
{
public virtual ApplicationUser Source { get; set; }
public virtual string SourceId { get; set; }
public virtual ApplicationUser Destination { get; set; }
public virtual string DestinationId { get; set; }
public virtual int Amount { get; set; }
public DateTime? TimePaid { get; set; }
}
The
Source
is the originator of the claim, the
Destination
their debtor, or 'target'. Once payment is confirmed, the claim has a non-null
TimePaid
value.
Oh yes, our players are a tiny and quite irrelevant extension to the
ApplicationUser
provided by the MVC project template, but copied here because someone always wants 'more code!'
public class ApplicationUser : IdentityUser, IBaseEntity
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
return userIdentity;
}
public string FullName { get; set; }
public int Balance { get; set; }
}
Only the two declared properties are my fine craftsmanship. And
ApplicationUser
the only source.
IdentityUser
and
IpreEntityntity
are part of an unholy library with a namespace of
Microsoft.AspNet.Identity.EntityFramework
.
Now I must 'tally', per player, in this p.o.v. the source, assuming most claims are valid and those paid are safer to assume valid, their biggest win and total winnings. I am tired, used LINQ grouping about twice ever, and need a hand with this please.