Beispiel #1
0
        public async Task <HttpResponseMessage> GetPatternById(int id)
        {
            HttpResponseMessage response;
            var pattern = await _patternService.GetPatternByIdAsync(id);

            if (pattern == null)
            {
                response = new HttpResponseMessage(HttpStatusCode.NotFound);
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.OK, pattern);
            }
            return(response);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            Pattern = await _patternService.GetPatternByIdAsync(id.Value);

            if (Pattern == null)
            {
                return(NotFound());
            }

            return(Page());
        }