예제 #1
0
        public async Task <IActionResult> GetPerson([FromRoute] int id)
        {
            if (User.Identity.IsAuthenticated)
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var person = await _repository.GetPersonById(id);

                if (person == null)
                {
                    return(NotFound());
                }
                return(Ok(person));
            }
            else
            {
                return(StatusCode(418));
            }
        }