public StartRequestModel(IStartRequestModel source) { RequestKey = source.RequestKey; SessionKey = source.SessionKey; AppType = source.AppType; Path = source.Path; TimeStarted = source.TimeStarted; }
public Task StartRequest(IStartRequestModel model) => client.PermanentLog.StartRequest(new StartRequestModel(model));
public async Task StartRequest(IStartRequestModel startRequest) { try { var session = await appFactory.Sessions().Session(startRequest.SessionKey); if (session.ID.IsNotValid()) { session = await startPlaceholderSession(startRequest.SessionKey, new GeneratedKey().Value()); } XtiPath path; try { path = XtiPath.Parse(startRequest.Path); } catch { path = new XtiPath(AppName.Unknown); } if (string.IsNullOrWhiteSpace(path.Group)) { path = path.WithGroup("Home"); } if (string.IsNullOrWhiteSpace(path.Action)) { path = path.WithAction("Index"); } var appKey = new AppKey(path.App, AppType.Values.Value(startRequest.AppType)); var app = await appFactory.Apps().App(appKey); var version = await app.Version(path.Version); var resourceGroup = await version.ResourceGroup(path.Group); var resource = await resourceGroup.Resource(path.Action); var modCategory = await resourceGroup.ModCategory(); var modifier = await modCategory.Modifier(path.Modifier); var request = await appFactory.Requests().Request(startRequest.RequestKey); if (request.ID.IsValid()) { await request.Edit ( session, resource, modifier, startRequest.Path, startRequest.TimeStarted ); } else { await session.LogRequest ( startRequest.RequestKey, resource, modifier, startRequest.Path, startRequest.TimeStarted ); } } catch (Exception ex) { await handleError(ex); } }