コード例 #1
0
 public async Task RemoveCurrencyAsync(MikiContext context, User sentTo, int amount)
 {
     Currency -= amount;
     await context.SaveChangesAsync();
 }
コード例 #2
0
ファイル: LocalExperience.cs プロジェクト: DebuggerAu/Miki
 public static async Task <LocalExperience> GetAsync(MikiContext context, long serverId, long userId)
 {
     return(await context.LocalExperience.FindAsync(serverId, userId)
            ?? await CreateAsync(context, serverId, userId));
 }
コード例 #3
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <bool> ExistsAsync(MikiContext context, ulong id1, ulong id2)
 => await ExistsAsync(context, id1.ToDbLong(), id2.ToDbLong());
コード例 #4
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <List <Marriage> > GetProposalsReceived(MikiContext context, long asker)
 => await InternalGetProposalsReceivedAsync(context, asker);
コード例 #5
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <bool> IsBeingProposedBy(MikiContext context, long MarriageId)
 {
     return(await InternalGetProposalAsync(context, MarriageId) != null);
 }
コード例 #6
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public void AcceptProposal(MikiContext context)
 {
     TimeOfMarriage = DateTime.Now;
     IsProposing    = false;
 }
コード例 #7
0
 public static List <Marriage> GetMarriages(MikiContext context, long userid)
 {
     return(InternalGetMarriages(context, userid));
 }
コード例 #8
0
 public GlobalPasta GetParent(MikiContext context)
 {
     return(context.Pastas.Find(Id));
 }
コード例 #9
0
 public static List <Marriage> GetProposalsReceived(MikiContext context, long asker) => InternalGetProposalsReceived(context, asker);
コード例 #10
0
 public static Marriage GetMarriage(MikiContext context, ulong receiver, ulong asker) => GetMarriage(context, receiver.ToDbLong(), asker.ToDbLong());
コード例 #11
0
 public static async Task <Marriage> GetProposalReceivedAsync(MikiContext context, ulong receiver, ulong asker)
 {
     return(await GetProposalReceivedAsync(context, receiver.ToDbLong(), asker.ToDbLong()));
 }
コード例 #12
0
 public void Remove(MikiContext context)
 {
     context.UsersMarriedTo.Remove(this);
 }
コード例 #13
0
ファイル: LocalExperience.cs プロジェクト: DebuggerAu/Miki
 public static async Task <int> GetRankAsync(MikiContext context, long serverId, long userId)
 {
     return(await(await GetAsync(context, serverId, userId)).GetRank(context));
 }
コード例 #14
0
 public static bool ExistsAsMarriage(MikiContext context, long id1, long id2)
 {
     return(GetMarriage(context, id1, id2) != null);
 }
コード例 #15
0
 public static async Task <bool> IsBeingProposedBy(MikiContext context, long receiver, long asker)
 {
     return(await InternalGetProposalAsync(context, receiver, asker) != null);
 }
コード例 #16
0
 public static User CreateAsync(MikiContext m, IDiscordMessage e)
 {
     return(Create(m, e.Author));
 }
コード例 #17
0
 private static async Task <Marriage> InternalGetProposalAsync(MikiContext context, long receiver, long asker)
 {
     return(await context
            .Marriages
            .FindAsync(receiver, asker));
 }
コード例 #18
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <List <Marriage> > GetMarriagesAsync(MikiContext context, long userid)
 {
     return(await InternalGetMarriagesAsync(context, userid));
 }
コード例 #19
0
 private static List <Marriage> InternalGetProposalsSent(MikiContext context, long asker)
 {
     return(context.Marriages.Where(p => p.Id1 == asker && p.Proposing == true).ToList());
 }
コード例 #20
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 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());
 }
コード例 #21
0
 private static List <Marriage> InternalGetProposalsReceived(MikiContext context, long receiver)
 {
     return(context.Marriages.Where(p => p.Id2 == receiver && p.Proposing == true).ToList());
 }
コード例 #22
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public async Task RemoveAsync(MikiContext context)
 {
     context.Marriages.Remove(this);
     await context.SaveChangesAsync();
 }
コード例 #23
0
 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());
 }
コード例 #24
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <bool> ExistsAsMarriageAsync(MikiContext context, long id1, long id2)
 => await GetMarriageAsync(context, id1, id2) != null;
コード例 #25
0
 public async Task DeclineProposalAsync(MikiContext context)
 {
     context.Marriages.Remove(this);
     await context.SaveChangesAsync();
 }
コード例 #26
0
ファイル: Marriage.cs プロジェクト: SnipeFrost/Miki
 public static async Task <Marriage> GetMarriageAsync(MikiContext context, ulong receiver, ulong asker)
 => await GetMarriageAsync(context, receiver.ToDbLong(), asker.ToDbLong());
コード例 #27
0
 public static async Task <bool> ExistsAsync(MikiContext context, long id1, long id2)
 {
     return(await GetEntryAsync(context, id1, id2) != null);
 }
コード例 #28
0
 public bool IsDonator(MikiContext context)
 {
     return(context.Achievements.Find(Id, "donator") != null);
 }
コード例 #29
0
 public static async Task <List <User> > SearchUserAsync(MikiContext context, string name)
 {
     return(await context.Users
            .Where(x => x.Name.ToLower() == name.ToLower())
            .ToListAsync());
 }