/// <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);
        }
Beispiel #3
0
        /// <summary>
        /// process, delete (the) local authority for...
        /// </summary>
        /// <param name="theTouchpoint">the touchpoint</param>
        /// <param name="theLADCode">the local adinistrative district code</param>
        /// <param name="inScope">in scope</param>
        /// <returns>the result of the operation</returns>
        public async Task <HttpResponseMessage> ProcessDeleteAuthorityFor(
            string theTouchpoint,
            string theLADCode,
            IScopeLoggingContext inScope)
        {
            await inScope.EnterMethod();

            It.IsEmpty(theTouchpoint)
            .AsGuard <ArgumentNullException>(nameof(theTouchpoint));
            It.IsEmpty(theLADCode)
            .AsGuard <ArgumentNullException>(nameof(theLADCode));

            await inScope.Information($"seeking the admin district: '{theLADCode}'");

            var result = await Authorities.Get(theLADCode);

            It.IsNull(result)
            .AsGuard <NoContentException>();

            await inScope.Information($"candidate search complete: '{result.LADCode}'");

            await inScope.Information($"validating touchpoint integrity: '{result.TouchpointID}' == '{theTouchpoint}'");

            (result.TouchpointID != theTouchpoint)
            .AsGuard <NoContentException>(NoContentException.GetMessage(theTouchpoint));

            await inScope.Information($"deleting authority: '{result.Name}'");

            await Authorities.Delete(theLADCode);

            await inScope.Information($"preparing response...");

            var response = Respond.Ok();

            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);
        }