コード例 #1
0
        public IHttpActionResult GetResident(int residentId)
        {
            try
            {
                HttpRequires.IsTrue(residentId > 0, "A valid resident identifier is required");

                var response = _residentRepo.FindById(residentId);

                HttpAssert.Success(response);
                HttpAssert.NotNull(response, String.Format("Unable to find a resident with id [{0}]", residentId));

                return(Ok(response.Result));
            }
            catch (Exception ex)
            {
                if (_logger != null)
                {
                    _logger.Write(ex);
                }
                return(InternalServerError());
            }
        }