public async Task RemoveCurrencyAsync(MikiContext context, User sentTo, int amount) { Currency -= amount; await context.SaveChangesAsync(); }
public static async Task <LocalExperience> GetAsync(MikiContext context, long serverId, long userId) { return(await context.LocalExperience.FindAsync(serverId, userId) ?? await CreateAsync(context, serverId, userId)); }
public static async Task <bool> ExistsAsync(MikiContext context, ulong id1, ulong id2) => await ExistsAsync(context, id1.ToDbLong(), id2.ToDbLong());
public static async Task <List <Marriage> > GetProposalsReceived(MikiContext context, long asker) => await InternalGetProposalsReceivedAsync(context, asker);
public static async Task <bool> IsBeingProposedBy(MikiContext context, long MarriageId) { return(await InternalGetProposalAsync(context, MarriageId) != null); }
public void AcceptProposal(MikiContext context) { TimeOfMarriage = DateTime.Now; IsProposing = false; }
public static List <Marriage> GetMarriages(MikiContext context, long userid) { return(InternalGetMarriages(context, userid)); }
public GlobalPasta GetParent(MikiContext context) { return(context.Pastas.Find(Id)); }
public static List <Marriage> GetProposalsReceived(MikiContext context, long asker) => InternalGetProposalsReceived(context, asker);
public static Marriage GetMarriage(MikiContext context, ulong receiver, ulong asker) => GetMarriage(context, receiver.ToDbLong(), asker.ToDbLong());
public static async Task <Marriage> GetProposalReceivedAsync(MikiContext context, ulong receiver, ulong asker) { return(await GetProposalReceivedAsync(context, receiver.ToDbLong(), asker.ToDbLong())); }
public void Remove(MikiContext context) { context.UsersMarriedTo.Remove(this); }
public static async Task <int> GetRankAsync(MikiContext context, long serverId, long userId) { return(await(await GetAsync(context, serverId, userId)).GetRank(context)); }
public static bool ExistsAsMarriage(MikiContext context, long id1, long id2) { return(GetMarriage(context, id1, id2) != null); }
public static async Task <bool> IsBeingProposedBy(MikiContext context, long receiver, long asker) { return(await InternalGetProposalAsync(context, receiver, asker) != null); }
public static User CreateAsync(MikiContext m, IDiscordMessage e) { return(Create(m, e.Author)); }
private static async Task <Marriage> InternalGetProposalAsync(MikiContext context, long receiver, long asker) { return(await context .Marriages .FindAsync(receiver, asker)); }
public static async Task <List <Marriage> > GetMarriagesAsync(MikiContext context, long userid) { return(await InternalGetMarriagesAsync(context, userid)); }
private static List <Marriage> InternalGetProposalsSent(MikiContext context, long asker) { return(context.Marriages.Where(p => p.Id1 == asker && p.Proposing == true).ToList()); }
private static async Task <List <Marriage> > InternalGetProposalsReceivedAsync(MikiContext context, long receiver) { return(await context.Marriages .Where(p => p.Participants.FirstOrDefault(x => x.UserId == receiver && !x.Asker) != null && p.IsProposing == true) .Include(x => x.Participants) .ToListAsync()); }
private static List <Marriage> InternalGetProposalsReceived(MikiContext context, long receiver) { return(context.Marriages.Where(p => p.Id2 == receiver && p.Proposing == true).ToList()); }
public async Task RemoveAsync(MikiContext context) { context.Marriages.Remove(this); await context.SaveChangesAsync(); }
private static Marriage InternalGetMarriage(MikiContext context, long receiver, long asker) { return(context.Marriages.Where(tm => tm.Id1 == receiver && tm.Id2 == asker && tm.Proposing == false).FirstOrDefault()); }
public static async Task <bool> ExistsAsMarriageAsync(MikiContext context, long id1, long id2) => await GetMarriageAsync(context, id1, id2) != null;
public async Task DeclineProposalAsync(MikiContext context) { context.Marriages.Remove(this); await context.SaveChangesAsync(); }
public static async Task <Marriage> GetMarriageAsync(MikiContext context, ulong receiver, ulong asker) => await GetMarriageAsync(context, receiver.ToDbLong(), asker.ToDbLong());
public static async Task <bool> ExistsAsync(MikiContext context, long id1, long id2) { return(await GetEntryAsync(context, id1, id2) != null); }
public bool IsDonator(MikiContext context) { return(context.Achievements.Find(Id, "donator") != null); }
public static async Task <List <User> > SearchUserAsync(MikiContext context, string name) { return(await context.Users .Where(x => x.Name.ToLower() == name.ToLower()) .ToListAsync()); }