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(); } }
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); }
public Task DeleteRecord(WrapRecord record) { _table.Remove(record); return(_dbContext.SaveChangesAsync()); }
public async Task UpdateRecord(WrapRecord record) { _table.Update(record); await _dbContext.SaveChangesAsync(); }
private string BuildTargetUrl(WrapRecord record, string path) { return(record.TargetUrl.TrimEnd('/') + "/" + path + Request.QueryString.ToString()); }