/// <summary> /// process, get (the) area routing detail for... /// </summary> /// <param name="theTouchpointID">the touchpoint id</param> /// <param name="inScope">in logging scope</param> /// <returns>the currently running task containing the response message (success only)</returns> internal async Task <HttpResponseMessage> ProcessGetAreaRoutingDetailFor(string theTouchpointID, IScopeLoggingContext inScope) { await inScope.EnterMethod(); It.IsEmpty(theTouchpointID) .AsGuard <MalformedRequestException>(); await inScope.Information($"seeking the routing details: '{theTouchpointID}'"); var theDetail = await RoutingDetails.Get(theTouchpointID); It.IsNull(theDetail) .AsGuard <MalformedRequestException>(theTouchpointID); await inScope.Information($"candidate search complete: '{theDetail.TouchpointID}'"); await inScope.Information($"preparing response..."); var response = Respond.Ok().SetContent(theDetail); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }
/// <summary> /// process, delete an area routing detail using... /// </summary> /// <param name="theTouchpointID">the touchpoint id</param> /// <param name="inScope">in logging scope</param> /// <returns>the currently running task containing the response message (success or fail)</returns> internal async Task <HttpResponseMessage> ProcessDeleteAreaRoutingDetailUsing(string theTouchpointID, IScopeLoggingContext inScope) { await inScope.EnterMethod(); await inScope.Information($"deleting the routing details for '{theTouchpointID}'"); await RoutingDetails.Delete(theTouchpointID); await inScope.Information($"preparing response..."); var response = Respond.Ok(); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }
/// <summary> /// process, add new area routing detail /// </summary> /// <param name="theTouchpoint">the touchpoint</param> /// <param name="usingContent">using content</param> /// <param name="inScope">in scope</param> /// <returns>the result of the operation</returns> public async Task <HttpResponseMessage> ProcessAddAreaRoutingDetailUsing( string theContent, IScopeLoggingContext inScope) { await inScope.EnterMethod(); It.IsEmpty(theContent) .AsGuard <MalformedRequestException>(); await inScope.Information($"deserialising the submitted content: '{theContent}'"); var theCandidate = JsonConvert.DeserializeObject <IncomingRoutingDetail>(theContent); await inScope.Information("deserialisation complete..."); It.IsNull(theCandidate) .AsGuard <MalformedRequestException>(); await inScope.Information($"validating the candidate: '{theCandidate.TouchpointID}'"); await RoutingDetail.Validate(theCandidate); await inScope.Information($"validation complete..."); await inScope.Information($"adding the candidate: '{theCandidate.TouchpointID}'"); var result = await RoutingDetails.Add(theCandidate); await inScope.Information($"candidate addition complete..."); await inScope.Information($"preparing response..."); var response = Respond.Created().SetContent(result); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }
/// <summary> /// process, get all route id's /// </summary> /// <param name="inScope">in logging scope</param> /// <returns>the currently running task containing the response message (success only)</returns> internal async Task <HttpResponseMessage> ProcessGetAllRouteIDs(IScopeLoggingContext inScope) { await inScope.EnterMethod(); await inScope.Information("seeking all routing ids"); var result = await RoutingDetails.GetAllIDs(); await inScope.Information($"found {result.Count} record(s)..."); var theCandidate = $"{{ [{string.Join(", ", result.Select(x => $"\"{x}\""))}] }}"; await inScope.Information($"candidate content: '{theCandidate}'"); await inScope.Information($"preparing response..."); var response = Respond.Ok().SetContent(theCandidate); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }