コード例 #1
0
ファイル: RecordRepo.cs プロジェクト: ox208/Infrastructures
        public async Task <WrapRecord> CreateRecord(string newRecordName, RecordType type, string appid, string targetUrl, bool enabled, string tags)
        {
            await _createRecordLock.WaitAsync();

            try
            {
                await _table.EnsureUniqueString(t => t.RecordUniqueName, newRecordName);

                var newRecord = new WrapRecord
                {
                    RecordUniqueName = newRecordName.ToLower(),
                    Type             = type,
                    AppId            = appid,
                    TargetUrl        = targetUrl,
                    Enabled          = enabled,
                    Tags             = tags
                };
                await _table.AddAsync(newRecord);

                await _dbContext.SaveChangesAsync();

                return(newRecord);
            }
            finally
            {
                _createRecordLock.Release();
            }
        }
コード例 #2
0
        public async Task <WrapRecord> CreateRecord(string newRecordName, RecordType type, string appid, string targetUrl, bool enabled)
        {
            var newRecord = new WrapRecord
            {
                RecordUniqueName = newRecordName.ToLower(),
                Type             = type,
                AppId            = appid,
                TargetUrl        = targetUrl,
                Enabled          = enabled
            };
            await _table.AddAsync(newRecord);

            await _dbContext.SaveChangesAsync();

            return(newRecord);
        }
コード例 #3
0
ファイル: RecordRepo.cs プロジェクト: ox208/Infrastructures
 public Task DeleteRecord(WrapRecord record)
 {
     _table.Remove(record);
     return(_dbContext.SaveChangesAsync());
 }
コード例 #4
0
ファイル: RecordRepo.cs プロジェクト: ox208/Infrastructures
 public async Task UpdateRecord(WrapRecord record)
 {
     _table.Update(record);
     await _dbContext.SaveChangesAsync();
 }
コード例 #5
0
 private string BuildTargetUrl(WrapRecord record, string path)
 {
     return(record.TargetUrl.TrimEnd('/') + "/" + path + Request.QueryString.ToString());
 }