Exemplo n.º 1
0
        public void OnException(ExceptionContext context)
        {
            var payload = new ZResponse(context.Exception);

            context.Result = new JsonResult(payload, Helpers.DefaultJsonSettings);

            this.logger.LogError($"Error processing request. {context.Exception}");
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Locate([FromQuery] string name, [FromQuery] string address)
        {
            logger.LogInformation($"Locate({name}, {address}) request received  ...");
            var person = await LocatePerson(name, address);

            var response = new ZResponse(person);

            return(Json(response, Helpers.DefaultJsonSettings));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> FindPersons([FromQuery] string zip)
        {
            logger.LogInformation($"FindPersons({zip}) request received  ...");
            var persons = await coreService.FindPersons(zip);

            var response = new ZResponse(persons);

            return(Json(response, Helpers.DefaultJsonSettings));
        }
Exemplo n.º 4
0
        public static ZResponse getNodeInfo(String apiAddress)
        {
            using (var wc = new System.Net.WebClient())
            {
                // get CVR entry from remote API
                wc.Headers["User-Agent"] = "CvrLookup 0.1";
                String json = wc.DownloadString(apiAddress);

                // deserialize raw data into model data structure
                ZResponse zr = Newtonsoft.Json.JsonConvert.DeserializeObject <ZResponse>(json);

                return(zr);
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ZResponse = await _context.ZResponse.FirstOrDefaultAsync(m => m.ID == id);

            if (ZResponse == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ZResponse = await _context.ZResponse.FindAsync(id);

            if (ZResponse != null)
            {
                _context.ZResponse.Remove(ZResponse);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }