public async Task <ChanpropsRecord> Create(ChanpropsRecord model) { var tracking = peerChatDb.ChangeTracker.QueryTrackingBehavior; peerChatDb.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; var existingRecord = await Lookup(new ChanpropsLookup { channelmask = model.channelmask }); var record = existingRecord.FirstOrDefault(); model.setAt = DateTime.UtcNow; if (record == null) { var entry = await peerChatDb.AddAsync <ChanpropsRecord>(model); var num_modified = await peerChatDb.SaveChangesAsync(); peerChatDb.ChangeTracker.QueryTrackingBehavior = tracking; await ResyncChanPropsForChanMask(model.channelmask, model.kickExisting ?? false); return(entry.Entity); } else { model.Id = record.Id; var entry = peerChatDb.Update <ChanpropsRecord>(model); await peerChatDb.SaveChangesAsync(); peerChatDb.ChangeTracker.QueryTrackingBehavior = tracking; await ResyncChanPropsForChanMask(model.channelmask, model.kickExisting ?? false); return(entry.Entity); } }
public async Task <UsermodeRecord> Update(UsermodeRecord model) { var entry = peerChatDb.Update <UsermodeRecord>(model); await peerChatDb.SaveChangesAsync(); return(entry.Entity); }
public Task <GlobalOpersRecord> Update(GlobalOpersRecord model) { return(Task.Run(async() => { var entry = peerChatDb.Update <GlobalOpersRecord>(model); await peerChatDb.SaveChangesAsync(); return entry.Entity; })); }